From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Navid Emamdoost <navid.emamdoost@gmail.com>,
Kangjie Lu <kjlu@umn.edu>, Aditya Pakki <pakki001@umn.edu>
Cc: emamd001@umn.edu, smccaman@umn.edu,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>, Vinod Koul <vkoul@kernel.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 8250_lpss: check null return when calling pci_ioremap_bar
Date: Fri, 19 Jul 2019 16:37:35 +0300 [thread overview]
Message-ID: <20190719133735.GM9224@smile.fi.intel.com> (raw)
In-Reply-To: <20190719025443.2368-1-navid.emamdoost@gmail.com>
On Thu, Jul 18, 2019 at 09:54:42PM -0500, Navid Emamdoost wrote:
> pci_ioremap_bar may return null. This is eventually de-referenced at
> drivers/dma/dw/core.c:1154 and drivers/dma/dw/core.c:1168. A null check is
> needed to prevent null de-reference. I am adding the check and in case of
> failure returning -ENOMEM (I am not sure this is the best errno, you may
> consider it as a placeholder), and subsequently changing the caller’s
> return type, and propagating the error.
Thanks for the patch, my comments below.
> chip->irq = pci_irq_vector(pdev, 0);
> chip->regs = pci_ioremap_bar(pdev, 1);
> + if (!chip->regs)
> + return -ENOMEM;
This is the same case as below, it's fine to go on without DMA support.
> chip->pdata = &qrk_serial_dma_pdata;
So, I would rather to put like this...
Hold on, I remember someone already tried to fix this [1].
I dunno why it wasn't v5, due to [2].
Also, similar to yours, but wrong [3].
Thus, please, collaborate guys, and send one compiling solution based on [1].
> /* Falling back to PIO mode if DMA probing fails */
> ret = dw_dma_probe(chip);
> if (ret)
> - return;
> + return 0;
[1]: https://www.spinics.net/lists/linux-serial/msg33965.html
[2]: https://lists.01.org/pipermail/kbuild-all/2019-March/059215.html
[3]: https://lore.kernel.org/patchwork/patch/1051000/
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-07-19 13:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 2:54 [PATCH] 8250_lpss: check null return when calling pci_ioremap_bar Navid Emamdoost
2019-07-19 13:37 ` Andy Shevchenko [this message]
2019-07-19 15:15 ` Andy Shevchenko
2019-07-19 17:48 ` [PATCH v2] " Navid Emamdoost
2019-07-19 22:36 ` Andy Shevchenko
2019-07-26 11:32 ` Bartlomiej Zolnierkiewicz
2019-07-26 11:57 ` Andy Shevchenko
2019-07-26 19:53 ` [PATCH v3] " Navid Emamdoost
[not found] ` <CAEkB2ERhxLj7ogoy1E3j8d4MyEZqroWS1tPRxyJXR2oLhNz+LQ@mail.gmail.com>
2019-09-07 15:53 ` Andy Shevchenko
[not found] ` <CAEkB2ET-SQFiBbroxDFEVrPxto6a2wLJf0NM7R=ERcPargr66Q@mail.gmail.com>
2019-09-07 16:16 ` Andy Shevchenko
2019-07-19 13:58 ` [PATCH] " kbuild test robot
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=20190719133735.GM9224@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=emamd001@umn.edu \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=navid.emamdoost@gmail.com \
--cc=pakki001@umn.edu \
--cc=smccaman@umn.edu \
--cc=vkoul@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