svn commit: r273863 - head/sys/dev/agp

Tijl Coosemans tijl at FreeBSD.org
Thu Oct 30 14:36:28 UTC 2014


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) {


More information about the svn-src-all mailing list