diff options
-rw-r--r-- | security/selinux/ss/ebitmap.c | 11 | ||||
-rw-r--r-- | security/selinux/ss/ebitmap.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c index ae44c0c9401d..c1a6b22d48d9 100644 --- a/security/selinux/ss/ebitmap.c +++ b/security/selinux/ss/ebitmap.c | |||
@@ -193,7 +193,7 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap, | |||
193 | e_sft = delta % EBITMAP_UNIT_SIZE; | 193 | e_sft = delta % EBITMAP_UNIT_SIZE; |
194 | while (map) { | 194 | while (map) { |
195 | e_iter->maps[e_idx++] |= map & (-1UL); | 195 | e_iter->maps[e_idx++] |= map & (-1UL); |
196 | map >>= EBITMAP_UNIT_SIZE; | 196 | map = EBITMAP_SHIFT_UNIT_SIZE(map); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | c_iter = c_iter->next; | 199 | c_iter = c_iter->next; |
@@ -389,13 +389,13 @@ int ebitmap_read(struct ebitmap *e, void *fp) | |||
389 | 389 | ||
390 | if (startbit & (mapunit - 1)) { | 390 | if (startbit & (mapunit - 1)) { |
391 | printk(KERN_ERR "security: ebitmap start bit (%d) is " | 391 | printk(KERN_ERR "security: ebitmap start bit (%d) is " |
392 | "not a multiple of the map unit size (%Zd)\n", | 392 | "not a multiple of the map unit size (%u)\n", |
393 | startbit, mapunit); | 393 | startbit, mapunit); |
394 | goto bad; | 394 | goto bad; |
395 | } | 395 | } |
396 | if (startbit > e->highbit - mapunit) { | 396 | if (startbit > e->highbit - mapunit) { |
397 | printk(KERN_ERR "security: ebitmap start bit (%d) is " | 397 | printk(KERN_ERR "security: ebitmap start bit (%d) is " |
398 | "beyond the end of the bitmap (%Zd)\n", | 398 | "beyond the end of the bitmap (%u)\n", |
399 | startbit, (e->highbit - mapunit)); | 399 | startbit, (e->highbit - mapunit)); |
400 | goto bad; | 400 | goto bad; |
401 | } | 401 | } |
@@ -433,9 +433,8 @@ int ebitmap_read(struct ebitmap *e, void *fp) | |||
433 | 433 | ||
434 | index = (startbit - n->startbit) / EBITMAP_UNIT_SIZE; | 434 | index = (startbit - n->startbit) / EBITMAP_UNIT_SIZE; |
435 | while (map) { | 435 | while (map) { |
436 | n->maps[index] = map & (-1UL); | 436 | n->maps[index++] = map & (-1UL); |
437 | map = map >> EBITMAP_UNIT_SIZE; | 437 | map = EBITMAP_SHIFT_UNIT_SIZE(map); |
438 | index++; | ||
439 | } | 438 | } |
440 | } | 439 | } |
441 | ok: | 440 | ok: |
diff --git a/security/selinux/ss/ebitmap.h b/security/selinux/ss/ebitmap.h index e38a327dd703..f283b4367f54 100644 --- a/security/selinux/ss/ebitmap.h +++ b/security/selinux/ss/ebitmap.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #define EBITMAP_UNIT_SIZE BITS_PER_LONG | 21 | #define EBITMAP_UNIT_SIZE BITS_PER_LONG |
22 | #define EBITMAP_SIZE (EBITMAP_UNIT_NUMS * EBITMAP_UNIT_SIZE) | 22 | #define EBITMAP_SIZE (EBITMAP_UNIT_NUMS * EBITMAP_UNIT_SIZE) |
23 | #define EBITMAP_BIT 1ULL | 23 | #define EBITMAP_BIT 1ULL |
24 | #define EBITMAP_SHIFT_UNIT_SIZE(x) \ | ||
25 | (((x) >> EBITMAP_UNIT_SIZE / 2) >> EBITMAP_UNIT_SIZE / 2) | ||
24 | 26 | ||
25 | struct ebitmap_node { | 27 | struct ebitmap_node { |
26 | struct ebitmap_node *next; | 28 | struct ebitmap_node *next; |