Re: [patch] mmc: toshsd: move dereference below check for NULL

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

 



On 15 November 2014 19:56, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> We check for NULL pointers after dereferencing so it's too late.  Oddly
> enough, Smatch misses this code but complains about the caller passing
> NULL pointers to this function:
>
>         drivers/mmc/host/toshsd.c:389 toshsd_irq()
>         error: we previously assumed 'host->cmd' could be null (see line 349)
>
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Thanks! Applied for next.

Kind regards
Uffe

>
> diff --git a/drivers/mmc/host/toshsd.c b/drivers/mmc/host/toshsd.c
> index edb06d6..4666262 100644
> --- a/drivers/mmc/host/toshsd.c
> +++ b/drivers/mmc/host/toshsd.c
> @@ -206,14 +206,14 @@ static irqreturn_t toshsd_thread_irq(int irq, void *dev_id)
>  static void toshsd_cmd_irq(struct toshsd_host *host)
>  {
>         struct mmc_command *cmd = host->cmd;
> -       u8 *buf = (u8 *) cmd->resp;
> +       u8 *buf;
>         u16 data;
>
>         if (!host->cmd) {
>                 dev_warn(&host->pdev->dev, "Spurious CMD irq\n");
>                 return;
>         }
> -
> +       buf = (u8 *)cmd->resp;
>         host->cmd = NULL;
>
>         if (cmd->flags & MMC_RSP_PRESENT && cmd->flags & MMC_RSP_136) {
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux