From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Al Viro <viro@zeniv.linux.org.uk>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-fsdevel@vger.kernel.org
Subject: [viro-vfs:work.fdtable 13/13] kernel/fork.c:3242 unshare_fd() warn: passing a valid pointer to 'PTR_ERR'
Date: Tue, 13 Aug 2024 11:00:04 +0300 [thread overview]
Message-ID: <020d5bd0-2fae-481f-bc82-88e71de1137c@stanley.mountain> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.fdtable
head: 3f4b0acefd818ec43b68455994ac2bd5166c06ae
commit: 3f4b0acefd818ec43b68455994ac2bd5166c06ae [13/13] dup_fd(): change calling conventions
config: x86_64-randconfig-161-20240813 (https://download.01.org/0day-ci/archive/20240813/202408130945.I8wIAYBm-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202408130945.I8wIAYBm-lkp@intel.com/
smatch warnings:
kernel/fork.c:3242 unshare_fd() warn: passing a valid pointer to 'PTR_ERR'
vim +/PTR_ERR +3242 kernel/fork.c
60997c3d45d9a6 Christian Brauner 2020-06-03 3232 int unshare_fd(unsigned long unshare_flags, unsigned int max_fds,
60997c3d45d9a6 Christian Brauner 2020-06-03 3233 struct files_struct **new_fdp)
cf2e340f4249b7 JANAK DESAI 2006-02-07 3234 {
cf2e340f4249b7 JANAK DESAI 2006-02-07 3235 struct files_struct *fd = current->files;
cf2e340f4249b7 JANAK DESAI 2006-02-07 3236
cf2e340f4249b7 JANAK DESAI 2006-02-07 3237 if ((unshare_flags & CLONE_FILES) &&
a016f3389c0660 JANAK DESAI 2006-02-07 3238 (fd && atomic_read(&fd->count) > 1)) {
3f4b0acefd818e Al Viro 2024-08-06 3239 *new_fdp = dup_fd(fd, max_fds);
3f4b0acefd818e Al Viro 2024-08-06 3240 if (IS_ERR(*new_fdp)) {
3f4b0acefd818e Al Viro 2024-08-06 3241 *new_fdp = NULL;
3f4b0acefd818e Al Viro 2024-08-06 @3242 return PTR_ERR(new_fdp);
^^^^^^^^^^^^^^^^
err = PTR_ERR(*new_fdp);
*new_fdp = NULL;
return err;
3f4b0acefd818e Al Viro 2024-08-06 3243 }
a016f3389c0660 JANAK DESAI 2006-02-07 3244 }
cf2e340f4249b7 JANAK DESAI 2006-02-07 3245
cf2e340f4249b7 JANAK DESAI 2006-02-07 3246 return 0;
cf2e340f4249b7 JANAK DESAI 2006-02-07 3247 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2024-08-13 8:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 8:00 Dan Carpenter [this message]
2024-08-13 18:16 ` [viro-vfs:work.fdtable 13/13] kernel/fork.c:3242 unshare_fd() warn: passing a valid pointer to 'PTR_ERR' Al Viro
2024-08-14 1:03 ` Al Viro
2024-08-21 6:38 ` Shuah Khan
2024-08-22 0:15 ` Al Viro
2024-08-22 4:12 ` Shuah Khan
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=020d5bd0-2fae-481f-bc82-88e71de1137c@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=viro@zeniv.linux.org.uk \
/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).