NULL pointer reference in DRM

From: Andreas Schwab (schwab@suse.de)
Date: Sat Jan 19 2002 - 18:01:36 EST


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.

--- linux/drivers/char/drm/drm_memory.h.~1~ Sat Jan 19 23:46:22 2002
+++ linux/drivers/char/drm/drm_memory.h Fri Jan 18 23:26:31 2002
@@ -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
--- linux/drivers/char/drm/drm_vm.h.~1~ Sat Jan 19 23:47:13 2002
+++ linux/drivers/char/drm/drm_vm.h Fri Jan 18 23:26:31 2002
@@ -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;

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
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."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jan 23 2002 - 21:00:35 EST