]> git.baikalelectronics.ru Git - kernel.git/commit
net: ieee802154: handle iftypes as u32
authorAlexander Aring <aahringo@redhat.com>
Fri, 12 Nov 2021 03:09:16 +0000 (22:09 -0500)
committerStefan Schmidt <stefan@datenfreihafen.org>
Tue, 16 Nov 2021 17:02:46 +0000 (18:02 +0100)
commit3db85f21d4c10ca4eee0d2d03656592f5b517581
tree656789866dd54a4d881c91127155686a4f826264
parent66f12e5c0ac035b7a9743b2bdfff7bc1aae0953c
net: ieee802154: handle iftypes as u32

This patch fixes an issue that an u32 netlink value is handled as a
signed enum value which doesn't fit into the range of u32 netlink type.
If it's handled as -1 value some BIT() evaluation ends in a
shift-out-of-bounds issue. To solve the issue we set the to u32 max which
is s32 "-1" value to keep backwards compatibility and let the followed enum
values start counting at 0. This brings the compiler to never handle the
enum as signed and a check if the value is above NL802154_IFTYPE_MAX should
filter -1 out.

Fixes: be52204d1384 ("ieee802154: add new interface command")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20211112030916.685793-1-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
include/net/nl802154.h