lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202305240724.z3McDuYM-lkp@intel.com>
Date:   Wed, 24 May 2023 07:51:25 +0800
From:   kernel test robot <lkp@...el.com>
To:     Miquel Raynal <miquel.raynal@...tlin.com>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Luka Perkov <luka.perkov@...tura.hr>,
        Robert Marko <robert.marko@...tura.hr>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        linux-kernel@...r.kernel.org,
        Miquel Raynal <miquel.raynal@...tlin.com>
Subject: Re: [PATCH 2/2] nvmem: core: Expose cells through sysfs

Hi Miquel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on char-misc/char-misc-next char-misc/char-misc-linus linus/master v6.4-rc3 next-20230523]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Miquel-Raynal/ABI-sysfs-nvmem-cells-Expose-cells-through-sysfs/20230523-203042
base:   char-misc/char-misc-testing
patch link:    https://lore.kernel.org/r/20230523100239.307574-3-miquel.raynal%40bootlin.com
patch subject: [PATCH 2/2] nvmem: core: Expose cells through sysfs
config: arm-randconfig-r015-20230521
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 4faf3aaf28226a4e950c103a14f6fc1d1fdabb1b)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/22c370b2163e592b9c7b2b1a29c080110dbad018
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Miquel-Raynal/ABI-sysfs-nvmem-cells-Expose-cells-through-sysfs/20230523-203042
        git checkout 22c370b2163e592b9c7b2b1a29c080110dbad018
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/nvmem/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305240724.z3McDuYM-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/nvmem/core.c:367:6: warning: variable 'read_len' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (IS_ERR(content)) {
               ^~~~~~~~~~~~~~~
   drivers/nvmem/core.c:380:9: note: uninitialized use occurs here
           return read_len;
                  ^~~~~~~~
   drivers/nvmem/core.c:367:2: note: remove the 'if' if its condition is always false
           if (IS_ERR(content)) {
           ^~~~~~~~~~~~~~~~~~~~~~
   drivers/nvmem/core.c:338:26: note: initialize the variable 'read_len' to silence this warning
           size_t cell_sz, read_len;
                                   ^
                                    = 0
   1 warning generated.


vim +367 drivers/nvmem/core.c

   327	
   328	static struct nvmem_cell *nvmem_create_cell(struct nvmem_cell_entry *entry,
   329						    const char *id, int index);
   330	
   331	static ssize_t nvmem_cell_attr_read(struct file *filp, struct kobject *kobj,
   332					    struct bin_attribute *attr, char *buf,
   333					    loff_t pos, size_t count)
   334	{
   335		struct nvmem_cell_entry *entry;
   336		struct nvmem_cell *cell = NULL;
   337		struct nvmem_device *nvmem;
   338		size_t cell_sz, read_len;
   339		struct device *dev;
   340		void *content;
   341	
   342		if (attr->private)
   343			dev = attr->private;
   344		else
   345			dev = kobj_to_dev(kobj);
   346		nvmem = to_nvmem_device(dev);
   347	
   348		mutex_lock(&nvmem_mutex);
   349		list_for_each_entry(entry, &nvmem->cells, node) {
   350			if (strncmp(entry->name, attr->attr.name, XATTR_NAME_MAX))
   351				continue;
   352	
   353			cell = nvmem_create_cell(entry, entry->name, 0);
   354			if (IS_ERR(cell)) {
   355				mutex_unlock(&nvmem_mutex);
   356				return PTR_ERR(cell);
   357			}
   358	
   359			break;
   360		}
   361		mutex_unlock(&nvmem_mutex);
   362	
   363		if (!cell)
   364			return -EINVAL;
   365	
   366		content = nvmem_cell_read(cell, &cell_sz);
 > 367		if (IS_ERR(content)) {
   368			count = PTR_ERR(content);
   369			goto destroy_cell;
   370		}
   371	
   372		read_len = min_t(unsigned int, cell_sz - pos, count);
   373		memcpy(buf, content + pos, read_len);
   374		kfree(content);
   375	
   376	destroy_cell:
   377		kfree_const(cell->id);
   378		kfree(cell);
   379	
   380		return read_len;
   381	}
   382	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

View attachment "config" of type "text/plain" (151653 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ