public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: cang@codeaurora.org
Cc: linux-scsi@vger.kernel.org
Subject: [bug report] scsi: ufs: Try to save power mode change and UIC cmd completion timeout
Date: Mon, 9 Nov 2020 12:57:07 +0300	[thread overview]
Message-ID: <20201109095707.GA2453397@mwanda> (raw)

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

             reply	other threads:[~2020-11-09  9:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09  9:57 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-23  7:06 [bug report] scsi: ufs: Try to save power mode change and UIC cmd completion timeout Dan Carpenter
2022-05-23  7:13 Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201109095707.GA2453397@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=cang@codeaurora.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox