]> Pileus Git - ~andy/linux/blobdiff - security/selinux/hooks.c
SELinux: use define for number of bits in the mnt flags mask
[~andy/linux] / security / selinux / hooks.c
index 863f2059018658c2d1e2ed55da008712caa05fb9..e13d65a62104a8a3487dc472fd8fe9d53f4db1b7 100644 (file)
@@ -466,9 +466,12 @@ static int selinux_get_mnt_opts(const struct super_block *sb,
        if (!ss_initialized)
                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;
        /* 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)
                        opts->num_mnt_opts++;
                tmp >>= 1;