All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bios: fix a potential NULL deref in the PROM shadowing function
@ 2014-04-03 20:12 Martin Peres
       [not found] ` <1396555961-2252-1-git-send-email-martin.peres-GANU6spQydw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Peres @ 2014-04-03 20:12 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Martin Peres <martin.peres-GANU6spQydw@public.gmane.org>
---
 nvkm/subdev/bios/base.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/nvkm/subdev/bios/base.c b/nvkm/subdev/bios/base.c
index 3de7d81..5f8643d 100644
--- a/nvkm/subdev/bios/base.c
+++ b/nvkm/subdev/bios/base.c
@@ -183,10 +183,11 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios)
 		goto out;
 
 	bios->data = kmalloc(bios->size, GFP_KERNEL);
-	if (bios->data) {
-		for (i = 0; i < bios->size; i += 4)
-			((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i);
-	}
+	if (!bios->data)
+		goto out;
+
+	for (i = 0; i < bios->size; i += 4)
+		((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i);
 
 	/* check the PCI record header */
 	pcir = nv_ro16(bios, 0x0018);
-- 
1.9.1

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

end of thread, other threads:[~2014-05-29 23:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-03 20:12 [PATCH] bios: fix a potential NULL deref in the PROM shadowing function Martin Peres
     [not found] ` <1396555961-2252-1-git-send-email-martin.peres-GANU6spQydw@public.gmane.org>
2014-05-27  9:15   ` Martin Peres
     [not found]     ` <538457CD.5080208-GANU6spQydw@public.gmane.org>
2014-05-29 23:39       ` Ben Skeggs
     [not found]         ` <CACAvsv6SaRYhEp1QkWe_9H+XB1h8HQztZi-PP8FioE-1M2eAQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-05-29 23:43           ` Martin Peres

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.