From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Anna Schumaker <anna@kernel.org>,
linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, anna@kernel.org
Subject: Re: [PATCH 3/3] sunrpc: Add a sysfs file for adding a new xprt
Date: Mon, 20 Jan 2025 10:26:16 +0300 [thread overview]
Message-ID: <8d0e2cd9-e47e-48f5-ae73-0e19d08ae807@stanley.mountain> (raw)
In-Reply-To: <20250108213632.260498-4-anna@kernel.org>
Hi Anna,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Anna-Schumaker/NFS-Add-implid-to-sysfs/20250109-053732
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link: https://lore.kernel.org/r/20250108213632.260498-4-anna%40kernel.org
patch subject: [PATCH 3/3] sunrpc: Add a sysfs file for adding a new xprt
config: x86_64-randconfig-r073-20250119 (https://download.01.org/0day-ci/archive/20250120/202501200000.40Rg2rc6-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
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/202501200000.40Rg2rc6-lkp@intel.com/
New smatch warnings:
net/sunrpc/sysfs.c:288 rpc_sysfs_xprt_switch_add_xprt_store() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +288 net/sunrpc/sysfs.c
2b155d9a088aee Anna Schumaker 2025-01-08 260 static ssize_t rpc_sysfs_xprt_switch_add_xprt_store(struct kobject *kobj,
2b155d9a088aee Anna Schumaker 2025-01-08 261 struct kobj_attribute *attr,
2b155d9a088aee Anna Schumaker 2025-01-08 262 const char *buf, size_t count)
2b155d9a088aee Anna Schumaker 2025-01-08 263 {
2b155d9a088aee Anna Schumaker 2025-01-08 264 struct rpc_xprt_switch *xprt_switch =
2b155d9a088aee Anna Schumaker 2025-01-08 265 rpc_sysfs_xprt_switch_kobj_get_xprt(kobj);
2b155d9a088aee Anna Schumaker 2025-01-08 266 struct xprt_create xprt_create_args;
2b155d9a088aee Anna Schumaker 2025-01-08 267 struct rpc_xprt *xprt, *new;
2b155d9a088aee Anna Schumaker 2025-01-08 268
2b155d9a088aee Anna Schumaker 2025-01-08 269 if (!xprt_switch)
2b155d9a088aee Anna Schumaker 2025-01-08 270 return 0;
2b155d9a088aee Anna Schumaker 2025-01-08 271
2b155d9a088aee Anna Schumaker 2025-01-08 272 xprt = rpc_xprt_switch_get_main_xprt(xprt_switch);
2b155d9a088aee Anna Schumaker 2025-01-08 273 if (!xprt)
2b155d9a088aee Anna Schumaker 2025-01-08 274 goto out;
2b155d9a088aee Anna Schumaker 2025-01-08 275
2b155d9a088aee Anna Schumaker 2025-01-08 276 xprt_create_args.ident = xprt->xprt_class->ident;
2b155d9a088aee Anna Schumaker 2025-01-08 277 xprt_create_args.net = xprt->xprt_net;
2b155d9a088aee Anna Schumaker 2025-01-08 278 xprt_create_args.dstaddr = (struct sockaddr *)&xprt->addr;
2b155d9a088aee Anna Schumaker 2025-01-08 279 xprt_create_args.addrlen = xprt->addrlen;
2b155d9a088aee Anna Schumaker 2025-01-08 280 xprt_create_args.servername = xprt->servername;
2b155d9a088aee Anna Schumaker 2025-01-08 281 xprt_create_args.bc_xprt = xprt->bc_xprt;
2b155d9a088aee Anna Schumaker 2025-01-08 282 xprt_create_args.xprtsec = xprt->xprtsec;
2b155d9a088aee Anna Schumaker 2025-01-08 283 xprt_create_args.connect_timeout = xprt->connect_timeout;
2b155d9a088aee Anna Schumaker 2025-01-08 284 xprt_create_args.reconnect_timeout = xprt->max_reconnect_timeout;
2b155d9a088aee Anna Schumaker 2025-01-08 285
2b155d9a088aee Anna Schumaker 2025-01-08 286 new = xprt_create_transport(&xprt_create_args);
2b155d9a088aee Anna Schumaker 2025-01-08 287 if (IS_ERR_OR_NULL(new)) {
This should just be if (IS_ERR(new)) {, otherwise we end up with a
nonsense debate about whether impossible NULL returns should be handled
as a error or a success.
2b155d9a088aee Anna Schumaker 2025-01-08 @288 count = PTR_ERR(new);
2b155d9a088aee Anna Schumaker 2025-01-08 289 goto out_put_xprt;
2b155d9a088aee Anna Schumaker 2025-01-08 290 }
2b155d9a088aee Anna Schumaker 2025-01-08 291
2b155d9a088aee Anna Schumaker 2025-01-08 292 rpc_xprt_switch_add_xprt(xprt_switch, new);
2b155d9a088aee Anna Schumaker 2025-01-08 293 xprt_put(new);
2b155d9a088aee Anna Schumaker 2025-01-08 294
2b155d9a088aee Anna Schumaker 2025-01-08 295 out_put_xprt:
2b155d9a088aee Anna Schumaker 2025-01-08 296 xprt_put(xprt);
2b155d9a088aee Anna Schumaker 2025-01-08 297 out:
2b155d9a088aee Anna Schumaker 2025-01-08 298 xprt_switch_put(xprt_switch);
2b155d9a088aee Anna Schumaker 2025-01-08 299 return count;
2b155d9a088aee Anna Schumaker 2025-01-08 300 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2025-01-20 7:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 21:36 [PATCH 0/3] NFS & SUNRPC Sysfs Improvements Anna Schumaker
2025-01-08 21:36 ` [PATCH 1/3] NFS: Add implid to sysfs Anna Schumaker
2025-01-09 14:33 ` Benjamin Coddington
2025-01-09 20:51 ` Anna Schumaker
2025-01-08 21:36 ` [PATCH 2/3] sunrpc: Add a sysfs attr for xprtsec Anna Schumaker
2025-01-08 21:36 ` [PATCH 3/3] sunrpc: Add a sysfs file for adding a new xprt Anna Schumaker
2025-01-09 15:10 ` Benjamin Coddington
2025-01-09 20:54 ` Anna Schumaker
2025-01-13 14:10 ` Olga Kornievskaia
2025-01-13 21:52 ` Anna Schumaker
2025-01-14 15:09 ` Olga Kornievskaia
2025-01-20 7:26 ` Dan Carpenter [this message]
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=8d0e2cd9-e47e-48f5-ae73-0e19d08ae807@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=trond.myklebust@hammerspace.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