Skip to contentSkip to conversation

DRM bugfix

PATCH Abraham vd Merwe 1 participant 1 message Oct 5, 2001 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

Hi!

I found a small bug in drm_proc.h. DRM(_vm_info) tries to access dev->maplist, but dev->maplist is only intitialized when the device is opened, so if you do a cat /proc/dri/0/vm just after you load any DRM module (just before loading X), you'll get an oops and mess up the whole proc system in the process...

I've attached a fix for it. The patch is against the 2.4.10 kernel, but I think drm_proc.h in the 2.4.10 kernel is the same as in the DRI CVS repository.

Signature · 16 lines
Regards
 Abraham

One can never consent to creep when one feels an impulse to soar.
		-- Helen Keller

__________________________________________________________
 Abraham vd Merwe - 2d3D, Inc.

 Device Driver Development, Outsourcing, Embedded Systems

  Cell: +27 82 565 4451         Snailmail:
   Tel: +27 21 761 7549            Block C, Antree Park
   Fax: +27 21 761 7648            Doncaster Road
 Email: [email protected]         Kenilworth, 7700
  Http: http://www.2d3d.com        South Africa
drivers/char/drm/drm_proc.h +1 -1
diff -Nrup linux-2.4.10.orig/drivers/char/drm/drm_proc.h linux-2.4.10/drivers/char/drm/drm_proc.h
@@ -186,7 +186,7 @@ static int DRM(_vm_info)(char *buf, char
 	DRM_PROC_PRINT("slot	 offset	      size type flags	 "
 		       "address mtrr\n\n");
 	i = 0;
-	list_for_each(list, &dev->maplist->head) {
+	if (dev->maplist != NULL) list_for_each(list, &dev->maplist->head) {
 		r_list = (drm_map_list_t *)list;
 		map = r_list->map;
 		if(!map) continue;