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: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
eb4a5346e7
commit
27c5fb7a84
|
@ -16,9 +16,13 @@
|
||||||
char *tmp; \
|
char *tmp; \
|
||||||
\
|
\
|
||||||
tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC); \
|
tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC); \
|
||||||
sprintf(tmp, format, param); \
|
if (likely(tmp)) { \
|
||||||
strcat(str, tmp); \
|
sprintf(tmp, format, param); \
|
||||||
kfree(tmp); \
|
strcat(str, tmp); \
|
||||||
|
kfree(tmp); \
|
||||||
|
} else { \
|
||||||
|
strcat(str, "kmalloc failure in SPRINTFCAT"); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void report_jump_idx(u32 status, char *outstr)
|
static void report_jump_idx(u32 status, char *outstr)
|
||||||
|
|
Loading…
Reference in a new issue