Searched hist:"08992 b2078f673b2806e0be30d07f41012a650e7" (Results 1 – 3 of 3) sorted by relevance
/freebsd/sbin/ifconfig/ |
H A D | ifvxlan.c | diff 08992b2078f673b2806e0be30d07f41012a650e7 Mon Jun 19 19:37:52 CEST 2023 John Baldwin <jhb@FreeBSD.org> ifconfig: Avoid issues with trying to negate unsigned values.
The if_flags and if_cap fields hold a bitmask of flags. If a flag is the MSB of the field, then the logic in setifflags and setifcap which uses a < 0 check does the wrong thing (it tries to clear the flag rather than setting it). Also, trying to use -<FOO> doesn't actually work as the result is a nop. To fix, stop overloading setifcap and setifflags and instead add new dedicated action functions clearifcap and clearifflags for clearing a flag. The value passed in the argument to the command is now always the raw flag.
This was reported by a GCC warning after raising WARNS:
sbin/ifconfig/ifconfig.c:2061:33: error: integer overflow in expression '-2147483648' of type 'int' results in '-2147483648' [-Werror=overflow] 2061 | DEF_CMD("-txtlsrtlmt", -IFCAP_TXTLS_RTLMT, setifcap), | ^
Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40608
|
H A D | ifvlan.c | diff 08992b2078f673b2806e0be30d07f41012a650e7 Mon Jun 19 19:37:52 CEST 2023 John Baldwin <jhb@FreeBSD.org> ifconfig: Avoid issues with trying to negate unsigned values.
The if_flags and if_cap fields hold a bitmask of flags. If a flag is the MSB of the field, then the logic in setifflags and setifcap which uses a < 0 check does the wrong thing (it tries to clear the flag rather than setting it). Also, trying to use -<FOO> doesn't actually work as the result is a nop. To fix, stop overloading setifcap and setifflags and instead add new dedicated action functions clearifcap and clearifflags for clearing a flag. The value passed in the argument to the command is now always the raw flag.
This was reported by a GCC warning after raising WARNS:
sbin/ifconfig/ifconfig.c:2061:33: error: integer overflow in expression '-2147483648' of type 'int' results in '-2147483648' [-Werror=overflow] 2061 | DEF_CMD("-txtlsrtlmt", -IFCAP_TXTLS_RTLMT, setifcap), | ^
Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40608
|
H A D | ifconfig.c | diff 08992b2078f673b2806e0be30d07f41012a650e7 Mon Jun 19 19:37:52 CEST 2023 John Baldwin <jhb@FreeBSD.org> ifconfig: Avoid issues with trying to negate unsigned values.
The if_flags and if_cap fields hold a bitmask of flags. If a flag is the MSB of the field, then the logic in setifflags and setifcap which uses a < 0 check does the wrong thing (it tries to clear the flag rather than setting it). Also, trying to use -<FOO> doesn't actually work as the result is a nop. To fix, stop overloading setifcap and setifflags and instead add new dedicated action functions clearifcap and clearifflags for clearing a flag. The value passed in the argument to the command is now always the raw flag.
This was reported by a GCC warning after raising WARNS:
sbin/ifconfig/ifconfig.c:2061:33: error: integer overflow in expression '-2147483648' of type 'int' results in '-2147483648' [-Werror=overflow] 2061 | DEF_CMD("-txtlsrtlmt", -IFCAP_TXTLS_RTLMT, setifcap), | ^
Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40608
|