Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/linux Fix broken error checkin...
details: https://anonhg.NetBSD.org/src/rev/fcdc4aaf5ef2
branches: trunk
changeset: 806589:fcdc4aaf5ef2
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Mar 02 02:26:37 2015 +0000
description:
Fix broken error checking in kmalloc_array/kcalloc.
diffstat:
sys/external/bsd/drm2/include/linux/slab.h | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diffs (28 lines):
diff -r 0d16ad2465ed -r fcdc4aaf5ef2 sys/external/bsd/drm2/include/linux/slab.h
--- a/sys/external/bsd/drm2/include/linux/slab.h Sun Mar 01 23:39:28 2015 +0000
+++ b/sys/external/bsd/drm2/include/linux/slab.h Mon Mar 02 02:26:37 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: slab.h,v 1.4 2014/07/16 20:59:58 riastradh Exp $ */
+/* $NetBSD: slab.h,v 1.5 2015/03/02 02:26:37 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -96,16 +96,14 @@
static inline void *
kmalloc_array(size_t n, size_t size, gfp_t gfp)
{
- KASSERT(size != 0);
- KASSERT(n <= (SIZE_MAX / size));
+ if ((size != 0) && (n > (SIZE_MAX / size)))
+ return NULL;
return malloc((n * size), M_TEMP, linux_gfp_to_malloc(gfp));
}
static inline void *
kcalloc(size_t n, size_t size, gfp_t gfp)
{
- if ((size == 0) && (n > (SIZE_MAX / size)))
- return NULL;
return kmalloc_array(n, size, (gfp | __GFP_ZERO));
}
Home |
Main Index |
Thread Index |
Old Index