From: Janak Desai Date: Mon, 28 Mar 2016 15:09:46 +0000 (-0400) Subject: netlabel: fix a problem with netlbl_secattr_catmap_setrng() X-Git-Tag: v4.7-rc1~124^2~1^2~10 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=341e0cb593a2b7ec86dd6ca96c68eadc3f6fe1e6;p=karo-tx-linux.git netlabel: fix a problem with netlbl_secattr_catmap_setrng() We try to be clever and set large chunks of the bitmap at once, when possible; unfortunately we weren't very clever when we wrote the code and messed up the if-conditional. Fix this bug and restore proper operation. Signed-off-by: Janak Desai Signed-off-by: Paul Moore --- diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c index 28cddc85b700..1325776daa27 100644 --- a/net/netlabel/netlabel_kapi.c +++ b/net/netlabel/netlabel_kapi.c @@ -677,7 +677,7 @@ int netlbl_catmap_setrng(struct netlbl_lsm_catmap **catmap, u32 spot = start; while (rc == 0 && spot <= end) { - if (((spot & (BITS_PER_LONG - 1)) != 0) && + if (((spot & (BITS_PER_LONG - 1)) == 0) && ((end - spot) > BITS_PER_LONG)) { rc = netlbl_catmap_setlong(catmap, spot,