mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: linux-kernel@vger.kernel.org
Cc: dri-devel@lists.sourceforge.net
Subject: NULL pointer reference in DRM
Date: Sun, 20 Jan 2002 00:01:36 +0100	[thread overview]
Message-ID: <jen0zat06n.fsf@sykes.suse.de> (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.

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

                 reply	other threads:[~2002-01-19 23:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jen0zat06n.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=dri-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®