Page MenuHomeFreeBSD

netlink: Don't use a zero-length array
ClosedPublic

Authored by jhb on Feb 15 2024, 12:16 AM.
Tags
None
Referenced Files
F132351934: D43918.diff
Thu, Oct 16, 4:01 AM
Unknown Object (File)
Wed, Oct 15, 9:43 AM
Unknown Object (File)
Tue, Oct 14, 6:07 PM
Unknown Object (File)
Tue, Oct 14, 6:07 PM
Unknown Object (File)
Tue, Oct 14, 6:07 PM
Unknown Object (File)
Tue, Oct 14, 6:07 PM
Unknown Object (File)
Tue, Oct 14, 6:23 AM
Unknown Object (File)
Fri, Oct 3, 12:47 PM
Subscribers

Details

Summary

Define SNL_DECLARE_FIELD_PARSER* macros to create a parser that has
no output attributes only input fields and use this to define the
snl_donemsg_parser.

This removes the need for the zero-length nla_p_donemsg[] variable.
Zero length arrays are not valid in ISO C.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 56054
Build 52943: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Feb 15 2024, 12:16 AM
sys/netlink/netlink_snl.h
201

I can't obviously see a reason why out_size wouldn't be useful for a field-only parser. Both snl_field_parser and snl_attr_parser have callbacks that take the target allocated based on out_size.

Also field generally becomes before attr in the file AFAICT, so would suggest moving this code to line 176.

This revision is now accepted and ready to land.Feb 24 2024, 7:15 PM
This revision was automatically updated to reflect the committed changes.