[bug report] statmount: retrieve security mount options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Christian Brauner,

Commit aefff51e1c29 ("statmount: retrieve security mount options")
from Nov 14, 2024 (linux-next), leads to the following Smatch static
checker warning:

	fs/namespace.c:5120 statmount_opt_sec_array()
	info: return a literal instead of 'err'

fs/namespace.c
    5108 static int statmount_opt_sec_array(struct kstatmount *s, struct seq_file *seq)
    5109 {
    5110         struct vfsmount *mnt = s->mnt;
    5111         struct super_block *sb = mnt->mnt_sb;
    5112         size_t start = seq->count;
    5113         char *buf_start;
    5114         int err;
    5115 
    5116         buf_start = seq->buf + start;
    5117 
    5118         err = security_sb_show_options(seq, sb);
    5119         if (!err)
                     ^^^^
--> 5120                 return err;

The Smatch check is suggesting that the return statement should be "return 0;"
but I'm not totally sure.  It sort of looks like this if statement is reversed.

    5121 
    5122         if (unlikely(seq_has_overflowed(seq)))
    5123                 return -EAGAIN;
    5124 
    5125         if (seq->count == start)
    5126                 return 0;
    5127 
    5128         err = statmount_opt_unescape(seq, buf_start);
    5129         if (err < 0)
    5130                 return err;
    5131 
    5132         s->sm.opt_sec_num = err;
    5133         return 0;
    5134 }

regards,
dan carpenter




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux