Skip to contentSkip to conversation

drm/gk20a/fb: fix NULL dereference

PATCH In review Alexandre Courbot 2 participants 2 messages May 9, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/gk20a/fb: fix NULL dereference

gk20a_ram_put() can be called with a NULL nouveau_mem in case of error. Handle that case the way is it done in other RAM drivers.

---
 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +2 -0
index 403c88f07b99..7effd1a63458 100644
@@ -36,6 +36,8 @@ gk20a_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
 	int i;
 
 	*pmem = NULL;
+	if (unlikely(mem == NULL))
+		return;
 
 	for (i = 0; i < mem->size; i++) {
 		struct page *page;
Signature · 1 line
1.9.2
#1 lore raw
Quoted 2 lines · Alexandre Courbot

gk20a_ram_put() can be called with a NULL nouveau_mem in case of error. Handle that case the way is it done in other RAM drivers.

Got it, thanks!

Quoted 26 lines
---
 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +2 -1
index 403c88f07b99..7effd1a63458 100644
@@ -36,6 +36,8 @@ gk20a_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
        int i;
 
        *pmem = NULL;
+       if (unlikely(mem == NULL))
+               return;
 
        for (i = 0; i < mem->size; i++) {
                struct page *page;
--

1.9.2

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau