From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] mtd: cfi-flash: fail gracefully instead of crashing on NULL page
Date: Mon, 1 Mar 2021 16:57:30 +0100 [thread overview]
Message-ID: <20210301155730.GG5549@pengutronix.de> (raw)
In-Reply-To: <20210228190707.1451161-1-ahmad@a3f.at>
On Sun, Feb 28, 2021 at 08:07:05PM +0100, Ahmad Fatoum wrote:
> Until this is fixed, add a comment and have the driver return with an
> error instead of crashing on null pointer dereference if it's mapped to
> zero.
>
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> Cc: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
> drivers/mtd/nor/cfi_flash.c | 4 ++++
> 1 file changed, 4 insertions(+)
Applied, thanks
Sascha
>
> diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
> index 225b03ec3d23..ba0bd1b4ebdd 100644
> --- a/drivers/mtd/nor/cfi_flash.c
> +++ b/drivers/mtd/nor/cfi_flash.c
> @@ -969,6 +969,10 @@ static int cfi_probe_one(struct flash_info *info, int num)
> return PTR_ERR(iores);
> info->base = IOMEM(iores->start);
>
> + /* TODO: either remap memory region or disable NULL pointer page */
> + if (IS_ENABLED(CONFIG_MMU) && iores->start == 0)
> + return -EPERM;
> +
> ret = flash_detect_size(info);
> if (ret) {
> dev_warn(info->dev, "## Unknown FLASH on Bank at 0x%p - Size = 0x%08lx = %ld MB\n",
> --
> 2.30.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2021-03-01 15:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-28 19:07 Ahmad Fatoum
2021-02-28 19:07 ` [PATCH 2/3] usb: dwc2: fix mismatching argument to printf format specifier Ahmad Fatoum
2021-02-28 19:07 ` [PATCH 3/3] MIPS: qemu-malta: make barebox Malta images detectable Ahmad Fatoum
2021-03-01 15:57 ` Sascha Hauer [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=20210301155730.GG5549@pengutronix.de \
--to=sha@pengutronix.de \
--cc=ahmad@a3f.at \
--cc=barebox@lists.infradead.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