Commit af8e50cc authored by Eric Paris's avatar Eric Paris

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: default avatarEric Paris <eparis@redhat.com>
parent d355987f
...@@ -466,9 +466,12 @@ static int selinux_get_mnt_opts(const struct super_block *sb, ...@@ -466,9 +466,12 @@ static int selinux_get_mnt_opts(const struct super_block *sb,
if (!ss_initialized) if (!ss_initialized)
return -EINVAL; return -EINVAL;
/* make sure we always check enough bits to cover the mask */
BUILD_BUG_ON(SE_MNTMASK >= (1 << NUM_SEL_MNT_OPTS));
tmp = sbsec->flags & SE_MNTMASK; tmp = sbsec->flags & SE_MNTMASK;
/* count the number of mount options for this sb */ /* count the number of mount options for this sb */
for (i = 0; i < 8; i++) { for (i = 0; i < NUM_SEL_MNT_OPTS; i++) {
if (tmp & 0x01) if (tmp & 0x01)
opts->num_mnt_opts++; opts->num_mnt_opts++;
tmp >>= 1; tmp >>= 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment