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>] [day] [month] [year] [list]
Message-ID: <202204292110.C5vOQk2e-lkp@intel.com>
Date:   Fri, 29 Apr 2022 17:06:04 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Bart Van Assche <bvanassche@....org>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [bvanassche:ufs-for-next 6/6] drivers/ufs/core/ufshcd.c:5430
 ufshcd_uic_cmd_compl() error: we previously assumed 'priv->active_uic_cmd'
 could be null (see line 5418)

tree:   https://github.com/bvanassche/linux ufs-for-next
head:   d34bcd2acd8e932a32bf1aac6296ee8ea8d230d3
commit: d34bcd2acd8e932a32bf1aac6296ee8ea8d230d3 [6/6] scsi: ufs: Split struct ufs_hba
config: nios2-randconfig-m031-20220428 (https://download.01.org/0day-ci/archive/20220429/202204292110.C5vOQk2e-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/ufs/core/ufshcd.c:5430 ufshcd_uic_cmd_compl() error: we previously assumed 'priv->active_uic_cmd' could be null (see line 5418)

vim +5430 drivers/ufs/core/ufshcd.c

9333d77573485c8 drivers/scsi/ufs/ufshcd.c Venkat Gopalakrishnan 2019-11-14  5409  static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
6ccf44fe4cd7c45 drivers/scsi/ufs/ufshcd.c Seungwon Jeon         2013-06-26  5410  {
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5411  	struct ufs_hba_priv *priv = container_of(hba, typeof(*priv), hba);
9333d77573485c8 drivers/scsi/ufs/ufshcd.c Venkat Gopalakrishnan 2019-11-14  5412  	irqreturn_t retval = IRQ_NONE;
9333d77573485c8 drivers/scsi/ufs/ufshcd.c Venkat Gopalakrishnan 2019-11-14  5413  
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5414  	spin_lock(priv->host->host_lock);
a45f937110fa6b0 drivers/scsi/ufs/ufshcd.c Can Guo               2021-05-24  5415  	if (ufshcd_is_auto_hibern8_error(hba, intr_status))
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5416  		priv->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
a45f937110fa6b0 drivers/scsi/ufs/ufshcd.c Can Guo               2021-05-24  5417  
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19 @5418  	if ((intr_status & UIC_COMMAND_COMPL) && priv->active_uic_cmd) {
                                                                                                                                 ^^^^^^^^^^^^^^^^^^^^^
Check for NULL

d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5419  		priv->active_uic_cmd->argument2 |=
6ccf44fe4cd7c45 drivers/scsi/ufs/ufshcd.c Seungwon Jeon         2013-06-26  5420  			ufshcd_get_uic_cmd_result(hba);
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5421  		priv->active_uic_cmd->argument3 =
12b4fdb4f6bccb5 drivers/scsi/ufs/ufshcd.c Seungwon Jeon         2013-08-31  5422  			ufshcd_get_dme_attr_val(hba);
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5423  		if (!priv->uic_async_done)
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5424  			priv->active_uic_cmd->cmd_active = 0;
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5425  		complete(&priv->active_uic_cmd->done);
9333d77573485c8 drivers/scsi/ufs/ufshcd.c Venkat Gopalakrishnan 2019-11-14  5426  		retval = IRQ_HANDLED;
6ccf44fe4cd7c45 drivers/scsi/ufs/ufshcd.c Seungwon Jeon         2013-06-26  5427  	}
53b3d9c3fdda94d drivers/scsi/ufs/ufshcd.c Seungwon Jeon         2013-08-31  5428  
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5429  	if ((intr_status & UFSHCD_UIC_PWR_MASK) && priv->uic_async_done) {
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19 @5430  		priv->active_uic_cmd->cmd_active = 0;
                                                                                                ^^^^^^^^^^^^^^^^^^^^^^
Unchecked dereference.

d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5431  		complete(priv->uic_async_done);
9333d77573485c8 drivers/scsi/ufs/ufshcd.c Venkat Gopalakrishnan 2019-11-14  5432  		retval = IRQ_HANDLED;
9333d77573485c8 drivers/scsi/ufs/ufshcd.c Venkat Gopalakrishnan 2019-11-14  5433  	}
aa5c697988b4c7e drivers/scsi/ufs/ufshcd.c Stanley Chu           2020-06-15  5434  
aa5c697988b4c7e drivers/scsi/ufs/ufshcd.c Stanley Chu           2020-06-15  5435  	if (retval == IRQ_HANDLED)
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5436  		ufshcd_add_uic_command_trace(hba, priv->active_uic_cmd,
28fa68fc557a7eb drivers/scsi/ufs/ufshcd.c Bean Huo              2021-01-05  5437  					     UFS_CMD_COMP);
d34bcd2acd8e932 drivers/ufs/core/ufshcd.c Bart Van Assche       2022-03-19  5438  	spin_unlock(priv->host->host_lock);
9333d77573485c8 drivers/scsi/ufs/ufshcd.c Venkat Gopalakrishnan 2019-11-14  5439  	return retval;
6ccf44fe4cd7c45 drivers/scsi/ufs/ufshcd.c Seungwon Jeon         2013-06-26  5440  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ