You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix wrong struct layout in getInterfaceSpeedGLinkSettings
The `SIOCETHTOOL` IOCTL expects a pointer to an instance
of `ethtool_link_settings`.
E.g. it will read the `cmd` member to determine what to do.
However pytorch#346 reordered the memory layout of the pointer such that
actually and array of `__32` values (zeroed out) is passed.
Hence the IOCTL will either fail because an invalid command (`cmd=0`)
is passed or the values read later by e.g.
`ecmd.req.link_mode_masks_nwords` are something completely different.
So `ethtool_link_settings` has to come before the (stack) memory used in
the flexible array at the end of this struct.
To avoid GCC warnigns/errors (see pytorch#345) an union is used that provides
the current struct (i.e. with wrong order) and an access the actually
used `struct ethtool_link_settings` at the top.
0 commit comments