Skip to content

Commit c56a3c3

Browse files
committed
Adjust prototypes of netlink parsing functions
Change the type of "len" argument that is based on struct nlmsghdr.nlmsg_len from kernel_ulong_t to unsigned int. * defs.h (netlink_decoder_t, DECL_NETLINK): Change "len" argument type from kernel_ulong_t to unsigned int. * netlink.c (decode_nlmsgerr_attr_cookie, decode_nlmsgerr, decode_payload): Likewise. * netlink_selinux.c (decode_netlink_selinux): Likewise. * netlink_sock_diag.c (decode_family, decode_unix_diag_req, decode_meminfo, decode_unix_diag_vfs, decode_unix_diag_inode, decode_unix_diag_rqlen, decode_unix_diag_msg, decode_netlink_diag_req, print_group, decode_netlink_diag_ring, decode_netlink_diag_flags, decode_netlink_diag_msg, decode_packet_diag_req, decode_packet_diag_info, decode_packet_diag_mclist, decode_packet_diag_ring, decode_packet_diag_filter, decode_packet_diag_msg, decode_inet_addr, decode_inet_diag_hostcond, decode_inet_diag_markcond, decode_bytecode_data, decode_inet_diag_bc_op, decode_inet_diag_req_compat, decode_inet_diag_req_v2, decode_inet_diag_req, decode_inet_diag_meminfo, decode_tcpvegas_info, decode_tcp_dctcp_info, decode_tcp_bbr_info, decode_inet_diag_msg, decode_smc_diag_req, decode_smc_diag_conninfo, decode_smc_diag_lgrinfo, decode_smc_diag_msg, netlink_diag_decoder_t, decode_netlink_sock_diag): Likewise. * nlattr.c (fetch_nlattr, decode_nlattr_with_data, decode_nlattr, decode_nla_str, decode_nla_strn, DECODE_NLA_INTEGER): Likewise. * nlattr.h (nla_decoder_t, DECL_NLA, decode_nlattr): Likewise.
1 parent a950e13 commit c56a3c3

File tree

6 files changed

+56
-56
lines changed

6 files changed

+56
-56
lines changed

defs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,12 +703,12 @@ extern int decode_sg_io_v4(struct tcb *, const kernel_ulong_t arg);
703703
struct nlmsghdr;
704704

705705
typedef bool (*netlink_decoder_t)(struct tcb *, const struct nlmsghdr *,
706-
kernel_ulong_t addr, kernel_ulong_t len);
706+
kernel_ulong_t addr, unsigned int len);
707707

708708
#define DECL_NETLINK(name) \
709709
extern bool \
710710
decode_netlink_ ## name(struct tcb *, const struct nlmsghdr *, \
711-
kernel_ulong_t addr, kernel_ulong_t len)
711+
kernel_ulong_t addr, unsigned int len)
712712
DECL_NETLINK(selinux);
713713
DECL_NETLINK(sock_diag);
714714

netlink.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ print_cookie(struct tcb *const tcp,
300300
static bool
301301
decode_nlmsgerr_attr_cookie(struct tcb *const tcp,
302302
const kernel_ulong_t addr,
303-
const kernel_ulong_t len,
303+
const unsigned int len,
304304
const void *const opaque_data)
305305
{
306306
uint8_t cookie;
@@ -331,7 +331,7 @@ decode_nlmsgerr(struct tcb *const tcp,
331331
const int fd,
332332
const int family,
333333
kernel_ulong_t addr,
334-
kernel_ulong_t len,
334+
unsigned int len,
335335
const bool capped)
336336
{
337337
struct nlmsgerr err;
@@ -390,7 +390,7 @@ decode_payload(struct tcb *const tcp,
390390
const int family,
391391
const struct nlmsghdr *const nlmsghdr,
392392
const kernel_ulong_t addr,
393-
const kernel_ulong_t len)
393+
const unsigned int len)
394394
{
395395
if (nlmsghdr->nlmsg_type == NLMSG_ERROR) {
396396
decode_nlmsgerr(tcp, fd, family, addr, len,

netlink_selinux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ bool
3636
decode_netlink_selinux(struct tcb *const tcp,
3737
const struct nlmsghdr *const nlmsghdr,
3838
const kernel_ulong_t addr,
39-
const kernel_ulong_t len)
39+
const unsigned int len)
4040
{
4141
switch (nlmsghdr->nlmsg_type) {
4242
case SELNL_MSG_SETENFORCE: {

netlink_sock_diag.c

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
static void
7575
decode_family(struct tcb *const tcp, const uint8_t family,
76-
const kernel_ulong_t addr, const kernel_ulong_t len)
76+
const kernel_ulong_t addr, const unsigned int len)
7777
{
7878
tprints("{family=");
7979
printxval(addrfams, family, "AF_???");
@@ -90,7 +90,7 @@ decode_unix_diag_req(struct tcb *const tcp,
9090
const struct nlmsghdr *const nlmsghdr,
9191
const uint8_t family,
9292
const kernel_ulong_t addr,
93-
const kernel_ulong_t len)
93+
const unsigned int len)
9494
{
9595
struct unix_diag_req req = { .sdiag_family = family };
9696
const size_t offset = sizeof(req.sdiag_family);
@@ -135,11 +135,11 @@ print_meminfo(struct tcb *const tcp,
135135
static bool
136136
decode_meminfo(struct tcb *const tcp,
137137
const kernel_ulong_t addr,
138-
const kernel_ulong_t len,
138+
const unsigned int len,
139139
const void *const opaque_data)
140140
{
141141
uint32_t mem;
142-
size_t nmemb = len / sizeof(mem);
142+
const size_t nmemb = len / sizeof(mem);
143143

144144
if (!nmemb)
145145
return false;
@@ -154,7 +154,7 @@ decode_meminfo(struct tcb *const tcp,
154154
static bool
155155
decode_unix_diag_vfs(struct tcb *const tcp,
156156
const kernel_ulong_t addr,
157-
const kernel_ulong_t len,
157+
const unsigned int len,
158158
const void *const opaque_data)
159159
{
160160
struct unix_diag_vfs uv;
@@ -185,7 +185,7 @@ print_inode(struct tcb *const tcp,
185185
static bool
186186
decode_unix_diag_inode(struct tcb *const tcp,
187187
const kernel_ulong_t addr,
188-
const kernel_ulong_t len,
188+
const unsigned int len,
189189
const void *const opaque_data)
190190
{
191191
uint32_t inode;
@@ -203,7 +203,7 @@ decode_unix_diag_inode(struct tcb *const tcp,
203203
static bool
204204
decode_unix_diag_rqlen(struct tcb *const tcp,
205205
const kernel_ulong_t addr,
206-
const kernel_ulong_t len,
206+
const unsigned int len,
207207
const void *const opaque_data)
208208
{
209209
struct unix_diag_rqlen rql;
@@ -235,7 +235,7 @@ decode_unix_diag_msg(struct tcb *const tcp,
235235
const struct nlmsghdr *const nlmsghdr,
236236
const uint8_t family,
237237
const kernel_ulong_t addr,
238-
const kernel_ulong_t len)
238+
const unsigned int len)
239239
{
240240
struct unix_diag_msg msg = { .udiag_family = family };
241241
size_t offset = sizeof(msg.udiag_family);
@@ -274,7 +274,7 @@ decode_netlink_diag_req(struct tcb *const tcp,
274274
const struct nlmsghdr *const nlmsghdr,
275275
const uint8_t family,
276276
const kernel_ulong_t addr,
277-
const kernel_ulong_t len)
277+
const unsigned int len)
278278
{
279279
struct netlink_diag_req req = { .sdiag_family = family };
280280
const size_t offset = sizeof(req.sdiag_family);
@@ -321,7 +321,7 @@ print_group(struct tcb *const tcp,
321321
static bool
322322
decode_netlink_diag_groups(struct tcb *const tcp,
323323
const kernel_ulong_t addr,
324-
const kernel_ulong_t len,
324+
const unsigned int len,
325325
const void *const opaque_data)
326326
{
327327
kernel_ulong_t buf;
@@ -339,7 +339,7 @@ decode_netlink_diag_groups(struct tcb *const tcp,
339339
static bool
340340
decode_netlink_diag_ring(struct tcb *const tcp,
341341
const kernel_ulong_t addr,
342-
const kernel_ulong_t len,
342+
const unsigned int len,
343343
const void *const opaque_data)
344344
{
345345
struct netlink_diag_ring ndr;
@@ -361,7 +361,7 @@ decode_netlink_diag_ring(struct tcb *const tcp,
361361
static bool
362362
decode_netlink_diag_flags(struct tcb *const tcp,
363363
const kernel_ulong_t addr,
364-
const kernel_ulong_t len,
364+
const unsigned int len,
365365
const void *const opaque_data)
366366
{
367367
uint32_t flags;
@@ -389,7 +389,7 @@ decode_netlink_diag_msg(struct tcb *const tcp,
389389
const struct nlmsghdr *const nlmsghdr,
390390
const uint8_t family,
391391
const kernel_ulong_t addr,
392-
const kernel_ulong_t len)
392+
const unsigned int len)
393393
{
394394
struct netlink_diag_msg msg = { .ndiag_family = family };
395395
size_t offset = sizeof(msg.ndiag_family);
@@ -433,7 +433,7 @@ decode_packet_diag_req(struct tcb *const tcp,
433433
const struct nlmsghdr *const nlmsghdr,
434434
const uint8_t family,
435435
const kernel_ulong_t addr,
436-
const kernel_ulong_t len)
436+
const unsigned int len)
437437
{
438438
struct packet_diag_req req = { .sdiag_family = family };
439439
const size_t offset = sizeof(req.sdiag_family);
@@ -459,7 +459,7 @@ decode_packet_diag_req(struct tcb *const tcp,
459459
static bool
460460
decode_packet_diag_info(struct tcb *const tcp,
461461
const kernel_ulong_t addr,
462-
const kernel_ulong_t len,
462+
const unsigned int len,
463463
const void *const opaque_data)
464464
{
465465
struct packet_diag_info pinfo;
@@ -502,7 +502,7 @@ print_packet_diag_mclist(struct tcb *const tcp, void *const elem_buf,
502502
static bool
503503
decode_packet_diag_mclist(struct tcb *const tcp,
504504
const kernel_ulong_t addr,
505-
const kernel_ulong_t len,
505+
const unsigned int len,
506506
const void *const opaque_data)
507507
{
508508
struct packet_diag_mclist dml;
@@ -520,7 +520,7 @@ decode_packet_diag_mclist(struct tcb *const tcp,
520520
static bool
521521
decode_packet_diag_ring(struct tcb *const tcp,
522522
const kernel_ulong_t addr,
523-
const kernel_ulong_t len,
523+
const unsigned int len,
524524
const void *const opaque_data)
525525
{
526526
struct packet_diag_ring pdr;
@@ -545,10 +545,10 @@ decode_packet_diag_ring(struct tcb *const tcp,
545545
static bool
546546
decode_packet_diag_filter(struct tcb *const tcp,
547547
const kernel_ulong_t addr,
548-
const kernel_ulong_t len,
548+
const unsigned int len,
549549
const void *const opaque_data)
550550
{
551-
const kernel_ulong_t nmemb = len / sizeof(struct sock_filter);
551+
const unsigned int nmemb = len / sizeof(struct sock_filter);
552552
if (!nmemb || (unsigned short) nmemb != nmemb)
553553
return false;
554554

@@ -573,7 +573,7 @@ decode_packet_diag_msg(struct tcb *const tcp,
573573
const struct nlmsghdr *const nlmsghdr,
574574
const uint8_t family,
575575
const kernel_ulong_t addr,
576-
const kernel_ulong_t len)
576+
const unsigned int len)
577577
{
578578
struct packet_diag_msg msg = { .pdiag_family = family };
579579
size_t offset = sizeof(msg.pdiag_family);
@@ -627,7 +627,7 @@ print_inet_diag_sockid(const struct inet_diag_sockid *id, const uint8_t family)
627627
static void
628628
decode_inet_addr(struct tcb *const tcp,
629629
const kernel_ulong_t addr,
630-
const kernel_ulong_t len,
630+
const unsigned int len,
631631
const int family)
632632
{
633633
union {
@@ -663,7 +663,7 @@ decode_inet_addr(struct tcb *const tcp,
663663
static void
664664
decode_inet_diag_hostcond(struct tcb *const tcp,
665665
const kernel_ulong_t addr,
666-
const kernel_ulong_t len)
666+
const unsigned int len)
667667
{
668668
struct inet_diag_hostcond cond;
669669

@@ -699,7 +699,7 @@ print_inet_diag_bc_op(const struct inet_diag_bc_op *const op)
699699
static void
700700
decode_inet_diag_markcond(struct tcb *const tcp,
701701
const kernel_ulong_t addr,
702-
const kernel_ulong_t len)
702+
const unsigned int len)
703703
{
704704
struct inet_diag_markcond markcond;
705705

@@ -715,7 +715,7 @@ decode_inet_diag_markcond(struct tcb *const tcp,
715715
static void
716716
decode_bytecode_data(struct tcb *const tcp,
717717
const kernel_ulong_t addr,
718-
const kernel_ulong_t len,
718+
const unsigned int len,
719719
const unsigned char code)
720720
{
721721
switch (code) {
@@ -759,7 +759,7 @@ decode_bytecode_data(struct tcb *const tcp,
759759
static bool
760760
decode_inet_diag_bc_op(struct tcb *const tcp,
761761
const kernel_ulong_t addr,
762-
const kernel_ulong_t len,
762+
const unsigned int len,
763763
const void *const opaque_data)
764764
{
765765
struct inet_diag_bc_op op;
@@ -793,7 +793,7 @@ decode_inet_diag_req_compat(struct tcb *const tcp,
793793
const struct nlmsghdr *const nlmsghdr,
794794
const uint8_t family,
795795
const kernel_ulong_t addr,
796-
const kernel_ulong_t len)
796+
const unsigned int len)
797797
{
798798
struct inet_diag_req req = { .idiag_family = family };
799799
size_t offset = sizeof(req.idiag_family);
@@ -836,7 +836,7 @@ decode_inet_diag_req_v2(struct tcb *const tcp,
836836
const struct nlmsghdr *const nlmsghdr,
837837
const uint8_t family,
838838
const kernel_ulong_t addr,
839-
const kernel_ulong_t len)
839+
const unsigned int len)
840840
{
841841
struct inet_diag_req_v2 req = { .sdiag_family = family };
842842
size_t offset = sizeof(req.sdiag_family);
@@ -878,7 +878,7 @@ decode_inet_diag_req(struct tcb *const tcp,
878878
const struct nlmsghdr *const nlmsghdr,
879879
const uint8_t family,
880880
const kernel_ulong_t addr,
881-
const kernel_ulong_t len)
881+
const unsigned int len)
882882
{
883883
if (nlmsghdr->nlmsg_type == TCPDIAG_GETSOCK
884884
|| nlmsghdr->nlmsg_type == DCCPDIAG_GETSOCK)
@@ -892,7 +892,7 @@ decode_inet_diag_req(struct tcb *const tcp,
892892
static bool
893893
decode_inet_diag_meminfo(struct tcb *const tcp,
894894
const kernel_ulong_t addr,
895-
const kernel_ulong_t len,
895+
const unsigned int len,
896896
const void *const opaque_data)
897897
{
898898
struct inet_diag_meminfo minfo;
@@ -914,7 +914,7 @@ decode_inet_diag_meminfo(struct tcb *const tcp,
914914
static bool
915915
decode_tcpvegas_info(struct tcb *const tcp,
916916
const kernel_ulong_t addr,
917-
const kernel_ulong_t len,
917+
const unsigned int len,
918918
const void *const opaque_data)
919919
{
920920
struct tcpvegas_info vegas;
@@ -936,7 +936,7 @@ decode_tcpvegas_info(struct tcb *const tcp,
936936
static bool
937937
decode_tcp_dctcp_info(struct tcb *const tcp,
938938
const kernel_ulong_t addr,
939-
const kernel_ulong_t len,
939+
const unsigned int len,
940940
const void *const opaque_data)
941941
{
942942
struct tcp_dctcp_info dctcp;
@@ -959,7 +959,7 @@ decode_tcp_dctcp_info(struct tcb *const tcp,
959959
static bool
960960
decode_tcp_bbr_info(struct tcb *const tcp,
961961
const kernel_ulong_t addr,
962-
const kernel_ulong_t len,
962+
const unsigned int len,
963963
const void *const opaque_data)
964964
{
965965
struct tcp_bbr_info bbr;
@@ -1003,7 +1003,7 @@ decode_inet_diag_msg(struct tcb *const tcp,
10031003
const struct nlmsghdr *const nlmsghdr,
10041004
const uint8_t family,
10051005
const kernel_ulong_t addr,
1006-
const kernel_ulong_t len)
1006+
const unsigned int len)
10071007
{
10081008
struct inet_diag_msg msg = { .idiag_family = family };
10091009
size_t offset = sizeof(msg.idiag_family);
@@ -1048,7 +1048,7 @@ decode_smc_diag_req(struct tcb *const tcp,
10481048
const struct nlmsghdr *const nlmsghdr,
10491049
const uint8_t family,
10501050
const kernel_ulong_t addr,
1051-
const kernel_ulong_t len)
1051+
const unsigned int len)
10521052
{
10531053
struct smc_diag_req req = { .diag_family = family };
10541054
const size_t offset = sizeof(req.diag_family);
@@ -1091,7 +1091,7 @@ print_smc_diag_cursor(const struct smc_diag_cursor *const cursor)
10911091
static bool
10921092
decode_smc_diag_conninfo(struct tcb *const tcp,
10931093
const kernel_ulong_t addr,
1094-
const kernel_ulong_t len,
1094+
const unsigned int len,
10951095
const void *const opaque_data)
10961096
{
10971097
struct smc_diag_conninfo cinfo;
@@ -1124,7 +1124,7 @@ decode_smc_diag_conninfo(struct tcb *const tcp,
11241124
static bool
11251125
decode_smc_diag_lgrinfo(struct tcb *const tcp,
11261126
const kernel_ulong_t addr,
1127-
const kernel_ulong_t len,
1127+
const unsigned int len,
11281128
const void *const opaque_data)
11291129
{
11301130
struct smc_diag_lgrinfo linfo;
@@ -1157,7 +1157,7 @@ decode_smc_diag_msg(struct tcb *const tcp,
11571157
const struct nlmsghdr *const nlmsghdr,
11581158
const uint8_t family,
11591159
const kernel_ulong_t addr,
1160-
const kernel_ulong_t len)
1160+
const unsigned int len)
11611161
{
11621162
struct smc_diag_msg msg = { .diag_family = family };
11631163
size_t offset = sizeof(msg.diag_family);
@@ -1201,7 +1201,7 @@ typedef void (*netlink_diag_decoder_t)(struct tcb *,
12011201
const struct nlmsghdr *,
12021202
uint8_t family,
12031203
kernel_ulong_t addr,
1204-
kernel_ulong_t len);
1204+
unsigned int len);
12051205

12061206
static const struct {
12071207
const netlink_diag_decoder_t request, response;
@@ -1220,7 +1220,7 @@ bool
12201220
decode_netlink_sock_diag(struct tcb *const tcp,
12211221
const struct nlmsghdr *const nlmsghdr,
12221222
const kernel_ulong_t addr,
1223-
const kernel_ulong_t len)
1223+
const unsigned int len)
12241224
{
12251225
uint8_t family;
12261226

0 commit comments

Comments
 (0)