Page MenuHomeFreeBSD

stand: dev_net: correct net_open's interpretation of params
ClosedPublic

Authored by kevans on Feb 15 2019, 3:19 PM.
Tags
None
Referenced Files
F103434210: D19206.diff
Sun, Nov 24, 11:49 PM
F103434208: D19206.diff
Sun, Nov 24, 11:49 PM
F103434204: D19206.diff
Sun, Nov 24, 11:48 PM
F103434203: D19206.diff
Sun, Nov 24, 11:48 PM
Unknown Object (File)
Fri, Nov 22, 1:06 PM
Unknown Object (File)
Wed, Nov 20, 1:25 AM
Unknown Object (File)
Tue, Nov 19, 12:12 PM
Unknown Object (File)
Tue, Nov 19, 12:27 AM
Subscribers

Details

Summary

net_open previously casted the first vararg to a char * and this was half-OK: at first, it is passed to netif_open, which would cast it back to the struct devdesc * that it really is and use it properly. It is then strdup()d and used as the netdev_name, which is objectively wrong.

Correct it so that the first vararg is properly casted to a struct devdesc * and the netdev_name gets set properly to make it more clear at a glance that it's not doing something horribly wrong.

Reported by: mmel

I have a separate patch that const poisons machdep_hint in libsa/netif from before the realization hit me that netif_open really shouldn't be passed a string. I don't know if we care enough to do this, but I tend to think it wouldn't hurt as none of these things really do (or should) modify the hint.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This cleans up one of the abuses of the devdesc stuff. Thank you.

This revision is now accepted and ready to land.Feb 15 2019, 3:35 PM
mmel added a subscriber: mmel.

Yep, thanks.

This revision was automatically updated to reflect the committed changes.