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 kvcalloc



details:   https://anonhg.NetBSD.org/src/rev/ea3f263bd04f
branches:  trunk
changeset: 1028383:ea3f263bd04f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 10:51:31 2021 +0000

description:
kvcalloc

diffstat:

 sys/external/bsd/drm2/include/linux/mm.h |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r c195f0c6f630 -r ea3f263bd04f sys/external/bsd/drm2/include/linux/mm.h
--- a/sys/external/bsd/drm2/include/linux/mm.h  Sun Dec 19 10:51:24 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/mm.h  Sun Dec 19 10:51:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mm.h,v 1.19 2021/12/19 10:49:55 riastradh Exp $        */
+/*     $NetBSD: mm.h,v 1.20 2021/12/19 10:51:31 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -107,6 +107,16 @@
 }
 
 static inline void *
+kvcalloc(size_t nelem, size_t elemsize, gfp_t gfp)
+{
+
+       KASSERT(elemsize > 0);
+       if (SIZE_MAX/elemsize < nelem)
+               return NULL;
+       return kvzalloc(nelem * elemsize, gfp);
+}
+
+static inline void *
 kvmalloc_array(size_t nelem, size_t elemsize, gfp_t gfp)
 {
 



Home | Main Index | Thread Index | Old Index