Skip to contentSkip to conversation

NULL pointer reference in DRM

PATCH Andreas Schwab 1 participant 1 message Jan 19, 2002 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

This patch fixes a NULL pointer reference when using a drm module that does not enforce AGP (like r128) on a system without an AGP card.

Andreas.

drivers/char/drm/drm_memory.h renamed from drivers/char/drm/drm_memory.h.~1~ +2 -2
@@ -322,7 +322,7 @@
 	}
 
 #if __REALLY_HAVE_AGP
-	if(dev->agp->cant_use_aperture == 0)
+	if(!dev->agp || dev->agp->cant_use_aperture == 0)
 		goto standard_ioremap;
 
 	list_for_each(list, &dev->maplist->head) {
@@ -382,7 +382,7 @@
 		DRM_MEM_ERROR(DRM_MEM_MAPPINGS,
 			      "Attempt to free NULL pointer\n");
 #if __REALLY_HAVE_AGP
-	else if(dev->agp->cant_use_aperture == 0)
+	else if(!dev->agp || dev->agp->cant_use_aperture == 0)
 #else
 	else
 #endif
drivers/char/drm/drm_vm.h renamed from drivers/char/drm/drm_vm.h.~1~ +1 -1
@@ -78,7 +78,7 @@
          * Find the right map
          */
 
-	if(!dev->agp->cant_use_aperture) goto vm_nopage_error;
+	if(!dev->agp || !dev->agp->cant_use_aperture) goto vm_nopage_error;
 
 	list_for_each(list, &dev->maplist->head) {
 		r_list = (drm_map_list_t *)list;
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."