Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Avoid dividing ...



details:   https://anonhg.NetBSD.org/src/rev/94c8aa706e4a
branches:  riastradh-drm2
changeset: 788579:94c8aa706e4a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Dec 30 04:51:24 2013 +0000

description:
Avoid dividing by zero when allocating empty array in kcalloc.

diffstat:

 sys/external/bsd/drm2/include/linux/slab.h |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 5502bd9785ea -r 94c8aa706e4a sys/external/bsd/drm2/include/linux/slab.h
--- a/sys/external/bsd/drm2/include/linux/slab.h        Mon Dec 30 04:51:15 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/slab.h        Mon Dec 30 04:51:24 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: slab.h,v 1.1.2.8 2013/07/24 04:01:51 riastradh Exp $   */
+/*     $NetBSD: slab.h,v 1.1.2.9 2013/12/30 04:51:24 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -76,7 +76,8 @@
 static inline void *
 kcalloc(size_t n, size_t size, gfp_t gfp)
 {
-       KASSERT(size <= (SIZE_MAX / n));
+       KASSERT(size != 0);
+       KASSERT(n <= (SIZE_MAX / size));
        return malloc((n * size), M_TEMP, (linux_gfp_to_malloc(gfp) | M_ZERO));
 }
 



Home | Main Index | Thread Index | Old Index