mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
crypto: caam - add allocation failure handling in SPRINTFCAT macro
commit 27c5fb7a84
upstream.
GFP_ATOMIC memory allocation could fail.
In this case, avoid NULL pointer dereference and notify user.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7ad8d3dbd9
commit
0c5e98d553
1 changed files with 7 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue