Merge tag 'keys-fixes-20200329' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / security / keys / internal.h
index ba3e2da14ceff60636d688cb1e4f78a7cb62b210..6d0ca48ae9a50cfb72c1de1df6182141d4da4ea7 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/keyctl.h>
 #include <linux/refcount.h>
 #include <linux/compat.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
 
 struct iovec;
 
@@ -349,4 +351,14 @@ static inline void key_check(const struct key *key)
 
 #endif
 
+/*
+ * Helper function to clear and free a kvmalloc'ed memory object.
+ */
+static inline void __kvzfree(const void *addr, size_t len)
+{
+       if (addr) {
+               memset((void *)addr, 0, len);
+               kvfree(addr);
+       }
+}
 #endif /* _INTERNAL_H */