Page MenuHomeFreeBSD

netlink: fix size comparison
ClosedPublic

Authored by glebius on Jan 3 2025, 6:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 2, 10:49 AM
Unknown Object (File)
Thu, Oct 2, 12:27 AM
Unknown Object (File)
Fri, Sep 26, 5:08 PM
Unknown Object (File)
Fri, Sep 26, 2:14 AM
Unknown Object (File)
Sep 9 2025, 10:29 PM
Unknown Object (File)
Sep 9 2025, 9:39 AM
Unknown Object (File)
Sep 4 2025, 4:00 PM
Unknown Object (File)
Sep 3 2025, 8:25 PM
Subscribers

Details

Summary

We want to check the size of the header, not a pointer to it.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added a subscriber: markj.
markj added inline comments.
sys/netlink/netlink_generic.c
70–71

It's nicer IMO to use sizeof(*hdr), although netlink is inconsistent about this.

This revision is now accepted and ready to land.Jan 3 2025, 6:32 PM
sys/netlink/netlink_generic.c
70–71

I personally prefer sizeof(type) when coding protocols that exchange data, cause a protocol specification talks about types not about our local variable names. That makes it easier to check that code follow protocol spec. For other cases I prefer sizeof(*var), cause var type may change, and often does.

This revision was automatically updated to reflect the committed changes.