[PATCH 3/3] backports: Add kvcalloc()

Hauke Mehrtens <[email protected]>
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
kvcalloc() was added in kernel commit 1c542f38ab8d ("mm: Introduce
kvcalloc()") and is now used by the fq header filers.

Signed-off-by: Hauke Mehrtens <[email protected]>
---
 backport/backport-include/linux/mm.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h
index b28156d3..8ff7d6a6 100644
--- a/backport/backport-include/linux/mm.h
+++ b/backport/backport-include/linux/mm.h
@@ -50,4 +50,12 @@ static inline void *kvzalloc(size_t size, gfp_t flags)
 }
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,18,0)
+#define kvcalloc LINUX_BACKPORT(kvcalloc)
+static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
+{
+	return kvmalloc_array(n, size, flags | __GFP_ZERO);
+}
+#endif /* < 4.18 */
+
 #endif /* __BACKPORT_MM_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.