mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>,
	<damien.lemoal@opensource.wdc.com>
Cc: <linux-ide@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ata: pata_pxa: Add missing check for devm_ioremap
Date: Thu, 9 Feb 2023 12:54:21 +0300	[thread overview]
Message-ID: <bd0d8eb2-4ee6-1e48-a1bb-ff37fe73df37@omp.ru> (raw)
In-Reply-To: <20230209092814.10847-1-jiasheng@iscas.ac.cn>

On 2/9/23 12:28 PM, Jiasheng Jiang wrote:

> Add the check for the return value of the devm_ioremap in order to avoid
> NULL pointer dereference.
> 
> Fixes: 2dc6c6f15da9 ("[ARM] pata_pxa: DMA-capable PATA driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/ata/pata_pxa.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
> index 985f42c4fd70..a20bb0824573 100644
> --- a/drivers/ata/pata_pxa.c
> +++ b/drivers/ata/pata_pxa.c
> @@ -227,6 +227,8 @@ static int pxa_ata_probe(struct platform_device *pdev)
>  						resource_size(ctl_res));
>  	ap->ioaddr.bmdma_addr	= devm_ioremap(&pdev->dev, dma_res->start,
>  						resource_size(dma_res));
> +	if (!ap->ioaddr.cmd_addr || !ap->ioaddr.ctl_addr || !ap->ioaddr.bmdma_addr)
> +		return -ENOMEM;

   Such patch has been posted already but the driver is more broken than just
this check missing, see:

https://lore.kernel.org/all/20220612073222.18974-1-liqiong@nfschina.com/

MBR, Sergey

      parent reply	other threads:[~2023-02-09  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09  9:28 Jiasheng Jiang
2023-02-09  9:54 ` Sergey Shtylyov
2023-02-09  9:54 ` Sergey Shtylyov [this message]

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=bd0d8eb2-4ee6-1e48-a1bb-ff37fe73df37@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=jiasheng@iscas.ac.cn \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®