[bug report] mmc: core: Add open-ended Ext memory addressing

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

 



Hello Avri Altman,

Commit 737d220bb2be ("mmc: core: Add open-ended Ext memory
addressing") from Oct 6, 2024 (linux-next), leads to the following
Smatch static checker warning:

	drivers/mmc/core/core.c:358 mmc_start_request()
	error: we previously assumed 'mrq->cmd' could be null (see line 339)

drivers/mmc/core/core.c
   335  int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
   336  {
   337          int err;
   338  
   339          if (mrq->cmd && mrq->cmd->has_ext_addr)
                    ^^^^^^^^
The patch addes this NULL check

   340                  mmc_send_ext_addr(host, mrq->cmd->ext_addr);
   341  
   342          init_completion(&mrq->cmd_completion);
   343  
   344          mmc_retune_hold(host);
   345  
   346          if (mmc_card_removed(host->card))
   347                  return -ENOMEDIUM;
   348  
   349          mmc_mrq_pr_debug(host, mrq, false);
   350  
   351          WARN_ON(!host->claimed);
   352  
   353          err = mmc_mrq_prep(host, mrq);
   354          if (err)
   355                  return err;
   356  
   357          led_trigger_event(host->led, LED_FULL);
   358          __mmc_start_request(host, mrq);
                                          ^^^
But if mrq->cmd is NULL the __mmc_start_request() function will crash.
Hopefully, we can just remove the NULL check.

   359  
   360          return 0;
   361  }

regards,
dan carpenter




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux