* [patch 1/2] selinux: ARRAY_SIZE cleanups
@ 2005-12-05 14:40 Stephen Smalley
2005-12-05 15:03 ` [patch 2/2] " Stephen Smalley
2005-12-05 21:32 ` [patch 1/2] " James Morris
0 siblings, 2 replies; 4+ messages in thread
From: Stephen Smalley @ 2005-12-05 14:40 UTC (permalink / raw)
To: lkml, James Morris, Andrew Morton; +Cc: Tobias Klauser, Nicolas Kaiser
From: Nicolas Kaiser <nikai@nikai.net>
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]).
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
security/selinux/selinuxfs.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff -X /home/sds/dontdiff -rup linux-2.6.15-rc5-mm1/security/selinux/selinuxfs.c a/security/selinux/selinuxfs.c
--- linux-2.6.15-rc5-mm1/security/selinux/selinuxfs.c 2005-12-05 09:07:04.000000000 -0500
+++ a/security/selinux/selinuxfs.c 2005-12-05 09:10:23.000000000 -0500
@@ -376,7 +376,7 @@ static ssize_t selinux_transaction_write
char *data;
ssize_t rv;
- if (ino >= sizeof(write_op)/sizeof(write_op[0]) || !write_op[ino])
+ if (ino >= ARRAY_SIZE(write_op) || !write_op[ino])
return -EINVAL;
data = simple_transaction_get(file, buf, size);
@@ -1161,7 +1161,7 @@ static int sel_make_avc_files(struct den
#endif
};
- for (i = 0; i < sizeof (files) / sizeof (files[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(files); i++) {
struct inode *inode;
struct dentry *dentry;
--
Stephen Smalley
National Security Agency
^ permalink raw reply [flat|nested] 4+ messages in thread* [patch 2/2] selinux: ARRAY_SIZE cleanups
2005-12-05 14:40 [patch 1/2] selinux: ARRAY_SIZE cleanups Stephen Smalley
@ 2005-12-05 15:03 ` Stephen Smalley
2005-12-05 21:33 ` James Morris
2005-12-05 21:32 ` [patch 1/2] " James Morris
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2005-12-05 15:03 UTC (permalink / raw)
To: lkml; +Cc: James Morris, Andrew Morton, Tobias Klauser, Nicolas Kaiser
From: Tobias Klauser <tklauser@nuerscht.ch>
Further ARRAY_SIZE cleanups under security/selinux.
Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
security/selinux/ss/avtab.c | 2 +-
security/selinux/ss/policydb.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff -X /home/sds/dontdiff -rup a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c
--- a/security/selinux/ss/avtab.c 2005-10-27 20:02:08.000000000 -0400
+++ b/security/selinux/ss/avtab.c 2005-12-05 09:12:00.000000000 -0500
@@ -359,7 +359,7 @@ int avtab_read_item(void *fp, u32 vers,
return -1;
}
- for (i = 0; i < sizeof(spec_order)/sizeof(u16); i++) {
+ for (i = 0; i < ARRAY_SIZE(spec_order); i++) {
if (val & spec_order[i]) {
key.specified = spec_order[i] | enabled;
datum.data = le32_to_cpu(buf32[items++]);
diff -X /home/sds/dontdiff -rup a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
--- a/security/selinux/ss/policydb.c 2005-12-05 09:06:40.000000000 -0500
+++ b/security/selinux/ss/policydb.c 2005-12-05 09:12:00.000000000 -0500
@@ -103,7 +103,7 @@ static struct policydb_compat_info *poli
int i;
struct policydb_compat_info *info = NULL;
- for (i = 0; i < sizeof(policydb_compat)/sizeof(*info); i++) {
+ for (i = 0; i < ARRAY_SIZE(policydb_compat); i++) {
if (policydb_compat[i].version == version) {
info = &policydb_compat[i];
break;
--
Stephen Smalley
National Security Agency
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch 2/2] selinux: ARRAY_SIZE cleanups
2005-12-05 15:03 ` [patch 2/2] " Stephen Smalley
@ 2005-12-05 21:33 ` James Morris
0 siblings, 0 replies; 4+ messages in thread
From: James Morris @ 2005-12-05 21:33 UTC (permalink / raw)
To: Stephen Smalley; +Cc: lkml, Andrew Morton, Tobias Klauser, Nicolas Kaiser
On Mon, 5 Dec 2005, Stephen Smalley wrote:
> From: Tobias Klauser <tklauser@nuerscht.ch>
>
> Further ARRAY_SIZE cleanups under security/selinux.
>
> Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 1/2] selinux: ARRAY_SIZE cleanups
2005-12-05 14:40 [patch 1/2] selinux: ARRAY_SIZE cleanups Stephen Smalley
2005-12-05 15:03 ` [patch 2/2] " Stephen Smalley
@ 2005-12-05 21:32 ` James Morris
1 sibling, 0 replies; 4+ messages in thread
From: James Morris @ 2005-12-05 21:32 UTC (permalink / raw)
To: Stephen Smalley; +Cc: lkml, Andrew Morton, Tobias Klauser, Nicolas Kaiser
On Mon, 5 Dec 2005, Stephen Smalley wrote:
> From: Nicolas Kaiser <nikai@nikai.net>
>
> Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]).
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-12-05 21:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-05 14:40 [patch 1/2] selinux: ARRAY_SIZE cleanups Stephen Smalley
2005-12-05 15:03 ` [patch 2/2] " Stephen Smalley
2005-12-05 21:33 ` James Morris
2005-12-05 21:32 ` [patch 1/2] " James Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®