mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: jean-michel.hautbois@vodalys.com
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	arnd@arndb.de, jhautbois@gmail.com
Subject: Re: [PATCH] Lattice ECP3 FPGA: Check firmware pointer
Date: Tue, 05 Aug 2014 18:22:10 +0200	[thread overview]
Message-ID: <s5hmwbi6h59.wl%tiwai@suse.de> (raw)
In-Reply-To: <1407255577-6946-1-git-send-email-jean-michel.hautbois@vodalys.com>

At Tue,  5 Aug 2014 18:19:37 +0200,
jean-michel.hautbois@vodalys.com wrote:
> 
> From: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
> 
> This patch corrects a lack of testing.
> If fw is NULL when calling firmware_load(), it results in a kernel oops.
> 
> Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>

Reviewed-by: Takashi Iwai <tiwai@suse.de>


Takashi

> ---
>  drivers/misc/lattice-ecp3-config.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c
> index 7ffdb58..7e1efd5 100644
> --- a/drivers/misc/lattice-ecp3-config.c
> +++ b/drivers/misc/lattice-ecp3-config.c
> @@ -79,6 +79,11 @@ static void firmware_load(const struct firmware *fw, void *context)
> 	u32 jedec_id;
> 	u32 status;
> 
> +	if (fw == NULL) {
> +		dev_err(&spi->dev, "Cannot load firmware, aborting\n");
> +		return;
> +	}
> +
> 	if (fw->size == 0) {
> 		dev_err(&spi->dev, "Error: Firmware size is 0!\n");
> 		return;
> --
> 2.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

      reply	other threads:[~2014-08-05 16:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 16:19 jean-michel.hautbois
2014-08-05 16:22 ` Takashi Iwai [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=s5hmwbi6h59.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jean-michel.hautbois@vodalys.com \
    --cc=jhautbois@gmail.com \
    --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®