mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] lib: jsmn: fix compilation error
@ 2024-09-11 11:13 Ahmad Fatoum
  2024-09-11 11:13 ` [PATCH master 2/2] include: stdlib.h: define prototypes for malloc/free Ahmad Fatoum
  2024-09-13  6:32 ` [PATCH master 1/2] lib: jsmn: fix compilation error Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-09-11 11:13 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@pengutronix.de>
---
 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-13  6:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-11 11:13 [PATCH master 1/2] lib: jsmn: fix compilation error Ahmad Fatoum
2024-09-11 11:13 ` [PATCH master 2/2] include: stdlib.h: define prototypes for malloc/free Ahmad Fatoum
2024-09-13  6:32 ` [PATCH master 1/2] lib: jsmn: fix compilation error Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox