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, Jun 18, 11:53 PM
Unknown Object (File)
Sat, Jun 13, 2:36 AM
Unknown Object (File)
Thu, Jun 4, 2:51 PM
Unknown Object (File)
Sun, May 31, 4:39 AM
Unknown Object (File)
Mon, May 25, 2:03 AM
Unknown Object (File)
Fri, May 22, 6:07 PM
Unknown Object (File)
May 16 2026, 10:07 AM
Unknown Object (File)
May 14 2026, 12:32 AM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 61488
Build 58372: arc lint + arc unit

Event Timeline

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

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

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.