Skip to content

Commit

Permalink
lsns: fix clang compiler warning
Browse files Browse the repository at this point in the history
../sys-utils/lsns.c:360:8: warning: comparison of integers of different signs: '__u32' (aka 'unsigned int') and 'int' [-Wsign-compare]
        if (!(NLMSG_OK(nlh, reslen)
              ^~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/netlink.h:90:24: note: expanded from macro 'NLMSG_OK'
                           (nlh)->nlmsg_len <= (len))
                           ~~~~~~~~~~~~~~~~ ^   ~~~

Signed-off-by: Ruediger Meier <[email protected]>
  • Loading branch information
rudimeier committed Feb 16, 2018
1 parent 497a261 commit 58b29ee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sys-utils/lsns.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ static int get_netnsid_via_netlink_recv_response(int *netnsid)
< RTA_SPACE(sizeof(struct nlmsgerr)))
? RTA_SPACE(sizeof(struct nlmsgerr))
: RTA_SPACE(sizeof(int32_t)))];
int reslen, rtalen;
int rtalen;
ssize_t reslen;

struct nlmsghdr *nlh;
struct rtattr *rta;
Expand All @@ -357,7 +358,7 @@ static int get_netnsid_via_netlink_recv_response(int *netnsid)
return -1;

nlh = (struct nlmsghdr *)res;
if (!(NLMSG_OK(nlh, reslen)
if (!(NLMSG_OK(nlh, (size_t)reslen)
&& nlh->nlmsg_type == RTM_NEWNSID))
return -1;

Expand Down

0 comments on commit 58b29ee

Please sign in to comment.