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

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
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -16,9 +16,13 @@
	char *tmp;						\
								\
	tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC);	\
	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)