Commit 27c5fb7a authored by Horia Geanta's avatar Horia Geanta Committed by Herbert Xu

crypto: caam - add allocation failure handling in SPRINTFCAT macro

GFP_ATOMIC memory allocation could fail.
In this case, avoid NULL pointer dereference and notify user.

Cc: <stable@vger.kernel.org> # 3.2+
Cc: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent eb4a5346
......@@ -16,9 +16,13 @@
char *tmp; \
\
tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC); \
sprintf(tmp, format, param); \
strcat(str, tmp); \
kfree(tmp); \
if (likely(tmp)) { \
sprintf(tmp, format, param); \
strcat(str, tmp); \
kfree(tmp); \
} else { \
strcat(str, "kmalloc failure in SPRINTFCAT"); \
} \
}
static void report_jump_idx(u32 status, char *outstr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment