[PATCH master 1/2] lib: jsmn: fix compilation error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With recent restructuring of the headers, kmalloc_array was no longer
indirectly included, which broke the build.

Add the missing headers and while at it switch over to normal malloc,
because kmalloc_array() uses a bigger alignment than necessary.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 lib/jsmn.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/jsmn.c b/lib/jsmn.c
index 10a77886a8bd..10ef349fa122 100644
--- a/lib/jsmn.c
+++ b/lib/jsmn.c
@@ -7,6 +7,8 @@
 #include <string.h>
 #include <stdio.h>
 #include <jsmn.h>
+#include <linux/overflow.h>
+#include <malloc.h>
 
 /**
  * Allocates a fresh unused token from the token pool.
@@ -391,7 +393,7 @@ JSMN_API jsmntok_t *jsmn_parse_alloc(const char *js, const size_t len,
 
 	token_count = ret;
 
-	tokens = kmalloc_array(token_count, sizeof(jsmntok_t), GFP_KERNEL);
+	tokens = malloc(size_mul(token_count, sizeof(jsmntok_t)));
 	if (!tokens)
 		return NULL;
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux