mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* NULL pointer reference in DRM
@ 2002-01-19 23:01 Andreas Schwab
  0 siblings, 0 replies; only message in thread
From: Andreas Schwab @ 2002-01-19 23:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: dri-devel

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."

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-19 23:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-19 23:01 NULL pointer reference in DRM Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®