Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Oct 2014 14:36:28 +0000 (UTC)
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273863 - head/sys/dev/agp
Message-ID:  <201410301436.s9UEaSHC061650@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tijl
Date: Thu Oct 30 14:36:27 2014
New Revision: 273863
URL: https://svnweb.freebsd.org/changeset/base/273863

Log:
  Avoid possible overflow in agp_generic_alloc_memory.
  
  MFC after:	1 week

Modified:
  head/sys/dev/agp/agp.c

Modified: head/sys/dev/agp/agp.c
==============================================================================
--- head/sys/dev/agp/agp.c	Thu Oct 30 14:26:36 2014	(r273862)
+++ head/sys/dev/agp/agp.c	Thu Oct 30 14:36:27 2014	(r273863)
@@ -485,7 +485,7 @@ agp_generic_alloc_memory(device_t dev, i
 	if ((size & (AGP_PAGE_SIZE - 1)) != 0)
 		return 0;
 
-	if (sc->as_allocated + size > sc->as_maxmem)
+	if (size > sc->as_maxmem - sc->as_allocated)
 		return 0;
 
 	if (type != 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410301436.s9UEaSHC061650>