ipmacsec: fix warning on 32bit platform
On some 32 bit platforms, the printf was causing warning: ipmacsec.c: In function ‘getattr_u64’: ipmacsec.c:655:47: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat=] fprintf(stderr, "invalid attribute length %lu\n", Resolve by computing length as size_t first. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
028766aed2
commit
79940533c0
|
|
@ -640,9 +640,11 @@ static void print_attrs(struct rtattr *attrs[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __u64 getattr_u64(struct rtattr *stat)
|
static __u64 getattr_u64(const struct rtattr *stat)
|
||||||
{
|
{
|
||||||
switch (RTA_PAYLOAD(stat)) {
|
size_t len = RTA_PAYLOAD(stat);
|
||||||
|
|
||||||
|
switch (len) {
|
||||||
case sizeof(__u64):
|
case sizeof(__u64):
|
||||||
return rta_getattr_u64(stat);
|
return rta_getattr_u64(stat);
|
||||||
case sizeof(__u32):
|
case sizeof(__u32):
|
||||||
|
|
@ -652,8 +654,8 @@ static __u64 getattr_u64(struct rtattr *stat)
|
||||||
case sizeof(__u8):
|
case sizeof(__u8):
|
||||||
return rta_getattr_u8(stat);
|
return rta_getattr_u8(stat);
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "invalid attribute length %lu\n",
|
fprintf(stderr, "invalid attribute length %zu\n",
|
||||||
RTA_PAYLOAD(stat));
|
len);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue