[PATCH 1/4] Properly account for alignment difference in nlmsg_len

Chris Wright chrisw at osdl.org
Wed May 11 16:06:12 UTC 2005


* Steve Grubb (sgrubb at redhat.com) wrote:
> On Wednesday 11 May 2005 04:01, Chris Wright wrote:
> > -                       nlh->nlmsg_len = skb->len - sizeof(*nlh);
> > +                       nlh->nlmsg_len = skb->len - NLMSG_SPACE(0);
> 
> Out of curiosity, is the code in audit_send_reply correct?
> 
>         nlh              = NLMSG_PUT(skb, pid, seq, t, len - sizeof(*nlh));
> 
> This was the place in code that I used to convince myself that I should copy 
> that idiom.

It could change as well (just for consistency).  The only diffference is
in alignment on 4 byte boundary, which for most architectures is already
the case.  The main reason I made that change is for symmetry with the
space already reserved in the skb for the header (I used NLMSG_SPACE(0)).

thanks,
-chris




More information about the Linux-audit mailing list