]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
SELinux: kills warnings in Improve SELinux performance when AVC misses
authorKaiGai Kohei <kaigai@kaigai.gr.jp>
Wed, 3 Oct 2007 14:42:56 +0000 (23:42 +0900)
committerJames Morris <jmorris@namei.org>
Tue, 16 Oct 2007 22:59:36 +0000 (08:59 +1000)
This patch kills ugly warnings when the "Improve SELinux performance
when ACV misses" patch.

Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com>
Signed-off-by: James Morris <jmorris@namei.org>
security/selinux/ss/ebitmap.c
security/selinux/ss/ebitmap.h

index ae44c0c9401d8386cb10d3a3044c24439ba3f83d..c1a6b22d48d9aa14195673c3f27f9d638ea05ee7 100644 (file)
@@ -193,7 +193,7 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap,
                        e_sft = delta % EBITMAP_UNIT_SIZE;
                        while (map) {
                                e_iter->maps[e_idx++] |= map & (-1UL);
-                               map >>= EBITMAP_UNIT_SIZE;
+                               map = EBITMAP_SHIFT_UNIT_SIZE(map);
                        }
                }
                c_iter = c_iter->next;
@@ -389,13 +389,13 @@ int ebitmap_read(struct ebitmap *e, void *fp)
 
                if (startbit & (mapunit - 1)) {
                        printk(KERN_ERR "security: ebitmap start bit (%d) is "
-                              "not a multiple of the map unit size (%Zd)\n",
+                              "not a multiple of the map unit size (%u)\n",
                               startbit, mapunit);
                        goto bad;
                }
                if (startbit > e->highbit - mapunit) {
                        printk(KERN_ERR "security: ebitmap start bit (%d) is "
-                              "beyond the end of the bitmap (%Zd)\n",
+                              "beyond the end of the bitmap (%u)\n",
                               startbit, (e->highbit - mapunit));
                        goto bad;
                }
@@ -433,9 +433,8 @@ int ebitmap_read(struct ebitmap *e, void *fp)
 
                index = (startbit - n->startbit) / EBITMAP_UNIT_SIZE;
                while (map) {
-                       n->maps[index] = map & (-1UL);
-                       map = map >> EBITMAP_UNIT_SIZE;
-                       index++;
+                       n->maps[index++] = map & (-1UL);
+                       map = EBITMAP_SHIFT_UNIT_SIZE(map);
                }
        }
 ok:
index e38a327dd703aed9c9dab8a9f06bc7a32ca15ce8..f283b4367f54d640e6a3b6fedb8f3180786883c3 100644 (file)
@@ -21,6 +21,8 @@
 #define EBITMAP_UNIT_SIZE      BITS_PER_LONG
 #define EBITMAP_SIZE           (EBITMAP_UNIT_NUMS * EBITMAP_UNIT_SIZE)
 #define EBITMAP_BIT            1ULL
+#define EBITMAP_SHIFT_UNIT_SIZE(x)                                     \
+       (((x) >> EBITMAP_UNIT_SIZE / 2) >> EBITMAP_UNIT_SIZE / 2)
 
 struct ebitmap_node {
        struct ebitmap_node *next;