Skip to content

Commit

Permalink
Lattice ECP3 FPGA: Check firmware pointer
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jean-Michel Hautbois authored and Greg Kroah-Hartman committed Sep 8, 2014
1 parent 69e273c commit 3f0d97d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/misc/lattice-ecp3-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3f0d97d

Please sign in to comment.