From: James Morris <jmorris@namei.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Stephen Smalley <sds@tycho.nsa.gov>
Subject: [PATCH 6/6] SELinux: kills warnings in Improve SELinux performance when AVC misses
Date: Wed, 10 Oct 2007 09:23:58 +1000 (EST) [thread overview]
Message-ID: <Xine.LNX.4.64.0710100923070.14862@us.intercode.com.au> (raw)
In-Reply-To: <Xine.LNX.4.64.0710100917010.14862@us.intercode.com.au>
From: KaiGai Kohei <kaigai@kaigai.gr.jp>
This patch kills ugly warnings when the "Improve SELinux performance when
AVC 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 | 11 +++++------
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 ae44c0c..c1a6b22 100644
--- a/security/selinux/ss/ebitmap.c
+++ b/security/selinux/ss/ebitmap.c
@@ -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:
diff --git a/security/selinux/ss/ebitmap.h b/security/selinux/ss/ebitmap.h
index e38a327..f283b43 100644
--- a/security/selinux/ss/ebitmap.h
+++ b/security/selinux/ss/ebitmap.h
@@ -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;
--
1.5.2.4
prev parent reply other threads:[~2007-10-09 23:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-09 23:18 [PATCH 0/6] SELinux patches for 2.6.24 James Morris
2007-10-09 23:19 ` [PATCH 1/6] SELinux: change Kconfig to use select instead of depends James Morris
2007-10-09 23:28 ` Randy Dunlap
2007-10-09 23:50 ` James Morris
2007-10-10 0:16 ` Randy Dunlap
2007-10-10 12:12 ` Stephen Smalley
2007-10-10 15:40 ` Randy Dunlap
2007-10-10 19:53 ` Valdis.Kletnieks
2007-10-10 19:57 ` Randy Dunlap
2007-10-09 23:20 ` [PATCH 2/6] SELinux: tune avtab to reduce memory usage James Morris
2007-10-09 23:21 ` [PATCH 3/6] SELinux: Improve read/write performance James Morris
2007-10-09 23:22 ` [PATCH 4/6] SELinux: policy selectable handling of unknown classes and perms James Morris
2007-10-09 23:23 ` [PATCH 5/6] SELinux: improve performance when AVC misses James Morris
2007-10-09 23:23 ` James Morris [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Xine.LNX.4.64.0710100923070.14862@us.intercode.com.au \
--to=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@tycho.nsa.gov \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome