All of lore.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, 23 May 2022 10:13:43 +0300	[thread overview]
Message-ID: <Yos0J9BQ/mO/aymX@kili> (raw)

[ Renaming the files means that all these old warnings show up  as new
  warnings.  I reported this two years ago but never heard back.  -dan ]

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/ufs/core/ufshcd.c:5283 ufshcd_uic_cmd_compl()
    error: we previously assumed 'hba->active_uic_cmd' could be null (see line 5271)

drivers/ufs/core/ufshcd.c
  5263        static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
  5264        {
  5265                irqreturn_t retval = IRQ_NONE;
  5266
  5267                spin_lock(hba->host->host_lock);
  5268                if (ufshcd_is_auto_hibern8_error(hba, intr_status))
  5269                        hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
  5270
  5271                if ((intr_status & UIC_COMMAND_COMPL) && hba->active_uic_cmd) {
                                                               ^^^^^^^^^^^^^^^^^^^
This code checks for NULL

  5272                        hba->active_uic_cmd->argument2 |=
  5273                                ufshcd_get_uic_cmd_result(hba);
  5274                        hba->active_uic_cmd->argument3 =
  5275                                ufshcd_get_dme_attr_val(hba);
  5276                        if (!hba->uic_async_done)
  5277                                hba->active_uic_cmd->cmd_active = 0;
  5278                        complete(&hba->active_uic_cmd->done);
  5279                        retval = IRQ_HANDLED;
  5280                }
  5281
  5282                if ((intr_status & UFSHCD_UIC_PWR_MASK) && hba->uic_async_done) {
  5283                        hba->active_uic_cmd->cmd_active = 0;
                              ^^^^^^^^^^^^^^^^^^^^^
Unchecked dereference

  5284                        complete(hba->uic_async_done);
  5285                        retval = IRQ_HANDLED;
  5286                }
  5287
  5288                if (retval == IRQ_HANDLED)
  5289                        ufshcd_add_uic_command_trace(hba, hba->active_uic_cmd,
                                                                ^^^^^^^^^^^^^^^^^^^
Unchecked dereference

  5290                                                     UFS_CMD_COMP);
  5291                spin_unlock(hba->host->host_lock);
  5292                return retval;
  5293        }



regards,
dan carpenter

             reply	other threads:[~2022-05-23  7:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23  7:13 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
2020-11-09  9:57 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=Yos0J9BQ/mO/aymX@kili \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.