linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Mickaël Salaün" <mic@linux.microsoft.com>
Cc: kbuild-all@lists.01.org, linux-security-module@vger.kernel.org,
	James Morris <jmorris@namei.org>
Subject: [security:landlock_lsm 8/12] security/landlock/syscall.c:216:13: warning: Uninitialized variable: ruleset
Date: Tue, 10 Nov 2020 18:12:57 +0800	[thread overview]
Message-ID: <202011101854.zGbWwusK-lkp@intel.com> (raw)

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

                 reply	other threads:[~2020-11-10 10:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202011101854.zGbWwusK-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jmorris@namei.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mic@linux.microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).