svn commit: r310245 - stable/11/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Mon Dec 19 09:40:30 UTC 2016


Author: hselasky
Date: Mon Dec 19 09:40:29 2016
New Revision: 310245
URL: https://svnweb.freebsd.org/changeset/base/310245

Log:
  MFC r309734:
  Avoid malloc() warnings when using the LinuxKPI by zero-checking
  the allocation flags.
  
  Obtained from:		kmacy @
  Sponsored by:           Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h
  stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h	Mon Dec 19 09:38:34 2016	(r310244)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h	Mon Dec 19 09:40:29 2016	(r310245)
@@ -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)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h	Mon Dec 19 09:38:34 2016	(r310244)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h	Mon Dec 19 09:40:29 2016	(r310245)
@@ -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)


More information about the svn-src-stable-11 mailing list