提交 526810ad 编写于 作者: R Roy Spliet 提交者: Ben Skeggs

drm/nv50/fb: Fix nullptr-deref on IGPs

When COMP_MAX_TAG == 0, the tags mm was uninitialised. Fixed by initialising with zero length.

v2: Fix style error
Signed-off-by: NRoy Spliet <r.spliet@student.tudelft.nl>
Tested-by: NRoy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
上级 1e98380c
...@@ -86,8 +86,8 @@ nouveau_fb_preinit(struct nouveau_fb *pfb) ...@@ -86,8 +86,8 @@ nouveau_fb_preinit(struct nouveau_fb *pfb)
return ret; return ret;
} }
if (!nouveau_mm_initialised(&pfb->tags) && tags) { if (!nouveau_mm_initialised(&pfb->tags)) {
ret = nouveau_mm_init(&pfb->tags, 0, ++tags, 1); ret = nouveau_mm_init(&pfb->tags, 0, tags ? ++tags : 0, 1);
if (ret) if (ret)
return ret; return ret;
} }
......
...@@ -99,7 +99,7 @@ nv50_fb_vram_init(struct nouveau_fb *pfb) ...@@ -99,7 +99,7 @@ nv50_fb_vram_init(struct nouveau_fb *pfb)
struct nouveau_bios *bios = nouveau_bios(device); struct nouveau_bios *bios = nouveau_bios(device);
const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */ const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */ const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */
u32 size; u32 size, tags = 0;
int ret; int ret;
pfb->ram.size = nv_rd32(pfb, 0x10020c); pfb->ram.size = nv_rd32(pfb, 0x10020c);
...@@ -140,10 +140,11 @@ nv50_fb_vram_init(struct nouveau_fb *pfb) ...@@ -140,10 +140,11 @@ nv50_fb_vram_init(struct nouveau_fb *pfb)
return ret; return ret;
pfb->ram.ranks = (nv_rd32(pfb, 0x100200) & 0x4) ? 2 : 1; pfb->ram.ranks = (nv_rd32(pfb, 0x100200) & 0x4) ? 2 : 1;
tags = nv_rd32(pfb, 0x100320);
break; break;
} }
return nv_rd32(pfb, 0x100320); return tags;
} }
static int static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册