mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Lattice ECP3 FPGA: Check firmware pointer
@ 2014-08-05 16:19 jean-michel.hautbois
  2014-08-05 16:22 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: jean-michel.hautbois @ 2014-08-05 16:19 UTC (permalink / raw)
  To: linux-kernel, gregkh, arnd; +Cc: jhautbois, Jean-Michel Hautbois

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>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-05 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05 16:19 [PATCH] Lattice ECP3 FPGA: Check firmware pointer jean-michel.hautbois
2014-08-05 16:22 ` Takashi Iwai

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®