[bug report] scsi: ufs: Try to save power mode change and UIC cmd completion timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Can Guo,

This is a semi-automatic email about new static checker warnings.

The patch 0f52fcb99ea2: "scsi: ufs: Try to save power mode change and
UIC cmd completion timeout" from Nov 2, 2020, leads to the following
Smatch complaint:

    drivers/scsi/ufs/ufshcd.c:4941 ufshcd_uic_cmd_compl()
    error: we previously assumed 'hba->active_uic_cmd' could be null (see line 4929)

drivers/scsi/ufs/ufshcd.c
  4928	
  4929		if ((intr_status & UIC_COMMAND_COMPL) && hba->active_uic_cmd) {
                                                         ^^^^^^^^^^^^^^^^^^^
Here is the NULL check

  4930			hba->active_uic_cmd->argument2 |=
  4931				ufshcd_get_uic_cmd_result(hba);
  4932			hba->active_uic_cmd->argument3 =
  4933				ufshcd_get_dme_attr_val(hba);
  4934			if (!hba->uic_async_done)
  4935				hba->active_uic_cmd->cmd_active = 0;
  4936			complete(&hba->active_uic_cmd->done);
  4937			retval = IRQ_HANDLED;
  4938		}
  4939	
  4940		if ((intr_status & UFSHCD_UIC_PWR_MASK) && hba->uic_async_done) {
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Smatch isn't clever enough to tie this to "hba->active_uic_cmd" and I
looked at it briefly and wasn't able to right away either.

  4941			hba->active_uic_cmd->cmd_active = 0;
                        ^^^^^^^^^^^^^^^^^^^^^
Unchecked NULL dereference.

  4942			complete(hba->uic_async_done);
  4943			retval = IRQ_HANDLED;

regards,
dan carpenter



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux