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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to