Re: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code

2015-09-19 Thread D. Hugh Redelmeier
Fixes have been proposed for this problem at least twice before. (These messages are not presented as a thread so I've put links to each of them) Problem report: Patch proposal: Reply suggesting

Re: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code

2015-09-11 Thread D. Hugh Redelmeier
| From: David Miller | From: "D. Hugh Redelmeier" | Date: Wed, 9 Sep 2015 16:24:07 -0400 (EDT) | > 1) netlink(3) says that the type of the second parameter is "int". | >From the synopsis: | >int NLMSG_OK(struct nlmsghdr *nlh, int len); | >

Re: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code

2015-09-11 Thread D. Hugh Redelmeier
| From: David Miller | Everyone either uses an unsigned type (such as "size_t") or adds an | explicit cast to an unsinged type for the second argument. That sounded odd to me. So I looked through the Fedora code base, as indexed by searchcode.com. This took a stupid

RE: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code

2015-09-11 Thread D. Hugh Redelmeier
| From: David Laight | From: D. Hugh Redelmeier | > #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ | >(nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ | >(nlh)->nlmsg_len <= (len)) | Why not cast

RE: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code

2015-09-11 Thread David Laight
From: D. Hugh Redelmeier > Sent: 09 September 2015 21:24 ... > 2) if you use the type "unsigned int" on a 32-bit machine, you get the >warning for an earlier conjunct: > > #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ > (nlh)->nlmsg_len >=

Re: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code

2015-09-09 Thread David Miller
From: "D. Hugh Redelmeier" Date: Wed, 9 Sep 2015 16:24:07 -0400 (EDT) > | From: David Miller > > | From: "D. Hugh Redelmeier" > | Date: Tue, 8 Sep 2015 09:46:56 -0400 (EDT) > | > | > Using netlink.h's NLMSG_OK correctly will cause GCC to

Re: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code

2015-09-09 Thread D. Hugh Redelmeier
| From: David Miller | From: "D. Hugh Redelmeier" | Date: Tue, 8 Sep 2015 09:46:56 -0400 (EDT) | | > Using netlink.h's NLMSG_OK correctly will cause GCC to issue a warning | > on systems with 32-bit userland. The definition can easily be changed | > to

Re: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code

2015-09-09 Thread David Miller
From: "D. Hugh Redelmeier" Date: Tue, 8 Sep 2015 09:46:56 -0400 (EDT) > Using netlink.h's NLMSG_OK correctly will cause GCC to issue a warning > on systems with 32-bit userland. The definition can easily be changed > to avoid this. Everyone either uses an unsigned type (such