diff options
author | Eric Paris <eparis@redhat.com> | 2012-08-24 15:59:00 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2013-07-25 13:02:58 -0400 |
commit | af8e50cc7d546c508e9091bbbdf3cf8b243bd8cd (patch) | |
tree | 9e0dde9b982f805c8260800163532888ed06869f /security/selinux/hooks.c | |
parent | d355987f47bbe24e7450b509a3f8aac0db88b65a (diff) |
SELinux: use define for number of bits in the mnt flags mask
We had this random hard coded value of '8' in the code (I put it there)
for the number of bits to check for mount options. This is stupid. Instead
use the #define we already have which tells us the number of mount
options.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 863f20590186..e13d65a62104 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -466,9 +466,12 @@ static int selinux_get_mnt_opts(const struct super_block *sb, | |||
466 | if (!ss_initialized) | 466 | if (!ss_initialized) |
467 | return -EINVAL; | 467 | return -EINVAL; |
468 | 468 | ||
469 | /* make sure we always check enough bits to cover the mask */ | ||
470 | BUILD_BUG_ON(SE_MNTMASK >= (1 << NUM_SEL_MNT_OPTS)); | ||
471 | |||
469 | tmp = sbsec->flags & SE_MNTMASK; | 472 | tmp = sbsec->flags & SE_MNTMASK; |
470 | /* count the number of mount options for this sb */ | 473 | /* count the number of mount options for this sb */ |
471 | for (i = 0; i < 8; i++) { | 474 | for (i = 0; i < NUM_SEL_MNT_OPTS; i++) { |
472 | if (tmp & 0x01) | 475 | if (tmp & 0x01) |
473 | opts->num_mnt_opts++; | 476 | opts->num_mnt_opts++; |
474 | tmp >>= 1; | 477 | tmp >>= 1; |