Linux-Security-Module Archive on lore.kernel.org
 help / color / Atom feed
* [security:landlock_lsm 8/12] security/landlock/syscall.c:216:13: warning: Uninitialized variable: ruleset
@ 2020-11-10 10:12 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-11-10 10:12 UTC (permalink / raw)
  To: Mickaël Salaün; +Cc: kbuild-all, linux-security-module, James Morris

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git landlock_lsm
head:   96b3198c4025c11347651700b77e45a686d78553
commit: 0c901260bd29a3d6019531d3a3fdff7859aa88e1 [8/12] landlock: Add syscall implementations
compiler: powerpc64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


"cppcheck warnings: (new ones prefixed by >>)"
>> security/landlock/syscall.c:216:13: warning: Uninitialized variable: ruleset [uninitvar]
    return err ? ERR_PTR(err) : ruleset;
               ^

vim +216 security/landlock/syscall.c

   189	
   190	/*
   191	 * Returns an owned ruleset from a FD. It is thus needed to call
   192	 * landlock_put_ruleset() on the return value.
   193	 */
   194	static struct landlock_ruleset *get_ruleset_from_fd(const int fd,
   195			const fmode_t mode)
   196	{
   197		struct fd ruleset_f;
   198		struct landlock_ruleset *ruleset;
   199		int err;
   200	
   201		ruleset_f = fdget(fd);
   202		if (!ruleset_f.file)
   203			return ERR_PTR(-EBADF);
   204	
   205		/* Checks FD type and access right. */
   206		err = 0;
   207		if (ruleset_f.file->f_op != &ruleset_fops)
   208			err = -EBADFD;
   209		else if (!(ruleset_f.file->f_mode & mode))
   210			err = -EPERM;
   211		if (!err) {
   212			ruleset = ruleset_f.file->private_data;
   213			landlock_get_ruleset(ruleset);
   214		}
   215		fdput(ruleset_f);
 > 216		return err ? ERR_PTR(err) : ruleset;
   217	}
   218	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 10:12 [security:landlock_lsm 8/12] security/landlock/syscall.c:216:13: warning: Uninitialized variable: ruleset kernel test robot

Linux-Security-Module Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-security-module/0 linux-security-module/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-security-module linux-security-module/ https://lore.kernel.org/linux-security-module \
		linux-security-module@vger.kernel.org
	public-inbox-index linux-security-module

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-security-module


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git