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-...@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-...@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 <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202308312145.bv4s52ys-...@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
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to