Skip to content

Commit

Permalink
netlink: Remove netlink_compare_arg.trailer
Browse files Browse the repository at this point in the history
Instead of computing the offset from trailer, this patch computes
netlink_compare_arg_len from the offset of portid and then adds 4
to it.  This allows trailer to be removed.

Reported-by: David Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Mar 21, 2015
1 parent 69a3b16 commit 8f2ddaa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,11 @@ struct netlink_compare_arg
{
possible_net_t pnet;
u32 portid;
char trailer[];
};

#define netlink_compare_arg_len offsetof(struct netlink_compare_arg, trailer)
/* Doing sizeof directly may yield 4 extra bytes on 64-bit. */
#define netlink_compare_arg_len \
(offsetof(struct netlink_compare_arg, portid) + sizeof(u32))

static inline int netlink_compare(struct rhashtable_compare_arg *arg,
const void *ptr)
Expand Down

0 comments on commit 8f2ddaa

Please sign in to comment.