aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2016-12-09 14:06:22 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2016-12-09 14:06:22 +0000
commitbe48ab92ac55e1168fdf49c4a046cea6747ad575 (patch)
treedfc050f2abb4f84257237a90210fdce8a9ecea29
parent0a61267a999ee631e1a6baccbece7e739d5b25ae (diff)
downloadsrc-be48ab92ac55e1168fdf49c4a046cea6747ad575.tar.gz
src-be48ab92ac55e1168fdf49c4a046cea6747ad575.zip
Avoid malloc() warnings when using the LinuxKPI by zero-checking
the allocation flags. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC after: 1 week
Notes
Notes: svn path=/head/; revision=309734
-rw-r--r--sys/compat/linuxkpi/common/include/linux/gfp.h2
-rw-r--r--sys/compat/linuxkpi/common/include/linux/slab.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/gfp.h b/sys/compat/linuxkpi/common/include/linux/gfp.h
index 374ed790656c..e1f14b0a82c6 100644
--- a/sys/compat/linuxkpi/common/include/linux/gfp.h
+++ b/sys/compat/linuxkpi/common/include/linux/gfp.h
@@ -64,7 +64,7 @@
#define GFP_IOFS M_NOWAIT
#define GFP_NOIO M_NOWAIT
#define GFP_DMA32 0
-#define GFP_TEMPORARY 0
+#define GFP_TEMPORARY M_NOWAIT
static inline void *
page_address(struct page *page)
diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h
index 1b17cef56745..d35f7a1ef89a 100644
--- a/sys/compat/linuxkpi/common/include/linux/slab.h
+++ b/sys/compat/linuxkpi/common/include/linux/slab.h
@@ -43,7 +43,7 @@ MALLOC_DECLARE(M_KMALLOC);
#define kmalloc(size, flags) malloc((size), M_KMALLOC, (flags))
#define kvmalloc(size) kmalloc((size), 0)
-#define kzalloc(size, flags) kmalloc((size), (flags) | M_ZERO)
+#define kzalloc(size, flags) kmalloc((size), M_ZERO | ((flags) ? (flags) : M_NOWAIT))
#define kzalloc_node(size, flags, node) kzalloc(size, flags)
#define kfree(ptr) free(__DECONST(void *, (ptr)), M_KMALLOC)
#define kfree_const(ptr) kfree(ptr)