[PATCH] Check if compared apertures are NULL

Stanislav Lisovskiy stanislav.lisovskiy at intel.com
Tue Dec 4 08:41:18 UTC 2018


Should fix a NULL deref, which might happen
if some of the ranges happen to be 0.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103927
Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>
---
 drivers/video/fbdev/core/fbmem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 861bf8081619..a587f8165587 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1575,8 +1575,12 @@ static bool fb_do_apertures_overlap(struct apertures_struct *gena,
 
 	for (i = 0; i < hwa->count; ++i) {
 		struct aperture *h = &hwa->ranges[i];
+		if (!h)
+			continue;
 		for (j = 0; j < gena->count; ++j) {
 			struct aperture *g = &gena->ranges[j];
+			if (!g)
+				continue;
 			printk(KERN_DEBUG "checking generic (%llx %llx) vs hw (%llx %llx)\n",
 				(unsigned long long)g->base,
 				(unsigned long long)g->size,
-- 
2.17.1



More information about the Intel-gfx-trybot mailing list