From: kernel test robot <lkp@intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
devel@driverdev.osuosl.org,
Alistair Francis <alistair.francis@wdc.com>
Subject: [driver-core:debugfs_cleanup 7/7] fs/sysfs/file.c:397:8: warning: variable 'uid' is uninitialized when used here
Date: Thu, 31 Aug 2023 21:39:11 +0800 [thread overview]
Message-ID: <202308312145.bv4S52ys-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_cleanup
head: 2929d17b58d02dcf52d0345fa966c616e09a5afa
commit: 2929d17b58d02dcf52d0345fa966c616e09a5afa [7/7] sysfs: do not create empty directories if no attributes are present
config: i386-randconfig-012-20230831 (https://download.01.org/0day-ci/archive/20230831/202308312145.bv4S52ys-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230831/202308312145.bv4S52ys-lkp@intel.com/reproduce)
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308312145.bv4S52ys-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> fs/sysfs/file.c:397:8: warning: variable 'uid' is uninitialized when used here [-Wuninitialized]
uid, gid, kobj, NULL);
^~~
fs/sysfs/file.c:383:2: note: variable 'uid' is declared here
kuid_t uid;
^
>> fs/sysfs/file.c:397:13: warning: variable 'gid' is uninitialized when used here [-Wuninitialized]
uid, gid, kobj, NULL);
^~~
fs/sysfs/file.c:384:2: note: variable 'gid' is declared here
kgid_t gid;
^
2 warnings generated.
vim +/uid +397 fs/sysfs/file.c
372
373 /**
374 * sysfs_add_file_to_group - add an attribute file to a pre-existing group.
375 * @kobj: object we're acting for.
376 * @attr: attribute descriptor.
377 * @group: group name.
378 */
379 int sysfs_add_file_to_group(struct kobject *kobj,
380 const struct attribute *attr, const char *group)
381 {
382 struct kernfs_node *parent;
383 kuid_t uid;
384 kgid_t gid;
385 int error;
386
387 if (group) {
388 parent = kernfs_find_and_get(kobj->sd, group);
389 } else {
390 parent = kobj->sd;
391 kernfs_get(parent);
392 }
393
394 if (!parent) {
395 parent = kernfs_create_dir_ns(kobj->sd, group,
396 S_IRWXU | S_IRUGO | S_IXUGO,
> 397 uid, gid, kobj, NULL);
398 if (IS_ERR(parent)) {
399 if (PTR_ERR(parent) == -EEXIST)
400 sysfs_warn_dup(kobj->sd, group);
401 return PTR_ERR(parent);
402 }
403
404 kernfs_get(parent);
405 }
406
407 kobject_get_ownership(kobj, &uid, &gid);
408 error = sysfs_add_file_mode_ns(parent, attr, attr->mode, uid, gid,
409 NULL);
410 kernfs_put(parent);
411
412 return error;
413 }
414 EXPORT_SYMBOL_GPL(sysfs_add_file_to_group);
415
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-08-31 14:01 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=202308312145.bv4S52ys-lkp@intel.com \
--to=lkp@intel.com \
--cc=alistair.francis@wdc.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.