[PATCH 12/19] ipmi: kcs_bmc: Strip private client data from struct kcs_bmc

kernel test robot lkp at intel.com
Mon Feb 22 00:55:49 AEDT 2021


Hi Andrew,

I love your patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on robh/for-next v5.11]
[cannot apply to joel-aspeed/for-next next-20210219]
[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]

url:    https://github.com/0day-ci/linux/commits/Andrew-Jeffery/ipmi-Allow-raw-access-to-KCS-devices/20210219-223144
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d19db80a366576d3ffadf2508ed876b4c1faf959
config: riscv-randconfig-r036-20210221 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/abe0bf80e7a3bf00fd82f8d73e9c0e2205bc2fca
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andrew-Jeffery/ipmi-Allow-raw-access-to-KCS-devices/20210219-223144
        git checkout abe0bf80e7a3bf00fd82f8d73e9c0e2205bc2fca
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> drivers/char/ipmi/kcs_bmc_cdev_ipmi.c:521:2: warning: variable 'priv' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
           list_for_each_entry(pos, &kcs_bmc_ipmi_instances, entry) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:629:7: note: expanded from macro 'list_for_each_entry'
                !list_entry_is_head(pos, head, member);                    \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/char/ipmi/kcs_bmc_cdev_ipmi.c:530:7: note: uninitialized use occurs here
           if (!priv)
                ^~~~
   drivers/char/ipmi/kcs_bmc_cdev_ipmi.c:521:2: note: remove the condition if it is always true
           list_for_each_entry(pos, &kcs_bmc_ipmi_instances, entry) {
           ^
   include/linux/list.h:629:7: note: expanded from macro 'list_for_each_entry'
                !list_entry_is_head(pos, head, member);                    \
                ^
   drivers/char/ipmi/kcs_bmc_cdev_ipmi.c:518:27: note: initialize the variable 'priv' to silence this warning
           struct kcs_bmc_ipmi *priv, *pos;
                                    ^
                                     = NULL
   1 warning generated.


vim +521 drivers/char/ipmi/kcs_bmc_cdev_ipmi.c

   515	
   516	int kcs_bmc_ipmi_detach_cdev(struct kcs_bmc_device *kcs_bmc)
   517	{
   518		struct kcs_bmc_ipmi *priv, *pos;
   519	
   520		spin_lock_irq(&kcs_bmc_ipmi_instances_lock);
 > 521		list_for_each_entry(pos, &kcs_bmc_ipmi_instances, entry) {
   522			if (pos->client.dev == kcs_bmc) {
   523				priv = pos;
   524				list_del(&pos->entry);
   525				break;
   526			}
   527		}
   528		spin_unlock_irq(&kcs_bmc_ipmi_instances_lock);
   529	
   530		if (!priv)
   531			return 0;
   532	
   533		misc_deregister(&priv->miscdev);
   534		kcs_bmc_disable_device(priv->client.dev, &priv->client);
   535		devm_kfree(kcs_bmc->dev, priv->kbuffer);
   536		devm_kfree(kcs_bmc->dev, priv->data_out);
   537		devm_kfree(kcs_bmc->dev, priv->data_in);
   538		devm_kfree(kcs_bmc->dev, priv);
   539	
   540		return 0;
   541	}
   542	EXPORT_SYMBOL(kcs_bmc_ipmi_detach_cdev);
   543	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 38080 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20210221/c063feca/attachment-0001.gz>


More information about the openbmc mailing list