diff options
author | Dmitry Mastykin <dmastykin@astralinux.ru> | 2023-06-08 15:57:54 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-06-10 20:54:06 +0200 |
commit | b403643d154d15176b060b82f7fc605210033edd (patch) | |
tree | 0197cdad58ee677b218e74f14cb5d62de5766cab | |
parent | Merge branch 'octeontx2-af-fixes' (diff) | |
download | linux-b403643d154d15176b060b82f7fc605210033edd.tar.xz linux-b403643d154d15176b060b82f7fc605210033edd.zip |
netlabel: fix shift wrapping bug in netlbl_catmap_setlong()
There is a shift wrapping bug in this code on 32-bit architectures.
NETLBL_CATMAP_MAPTYPE is u64, bitmap is unsigned long.
Every second 32-bit word of catmap becomes corrupted.
Signed-off-by: Dmitry Mastykin <dmastykin@astralinux.ru>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/netlabel/netlabel_kapi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c index 54c083003947..27511c90a26f 100644 --- a/net/netlabel/netlabel_kapi.c +++ b/net/netlabel/netlabel_kapi.c @@ -857,7 +857,8 @@ int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap, offset -= iter->startbit; idx = offset / NETLBL_CATMAP_MAPSIZE; - iter->bitmap[idx] |= bitmap << (offset % NETLBL_CATMAP_MAPSIZE); + iter->bitmap[idx] |= (NETLBL_CATMAP_MAPTYPE)bitmap + << (offset % NETLBL_CATMAP_MAPSIZE); return 0; } |