From 2597448a4a1d3b607abf64788458f2cf74b30d08 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 13 Jun 2014 23:58:28 +0000 Subject: [PATCH] scst: Help Coverity recognize that vmalloc(0) returns NULL Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5603 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index e63132be5..4ad508296 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -6470,7 +6470,12 @@ int scst_get_buf_full(struct scst_cmd *cmd, uint8_t **buf) len = scst_get_buf_next(cmd, &tmp_buf); } +#ifdef __COVERITY__ + /* Help Coverity recognize that vmalloc(0) returns NULL. */ + *buf = full_size ? vmalloc(full_size) : NULL; +#else *buf = vmalloc(full_size); +#endif if (*buf == NULL) { TRACE(TRACE_OUT_OF_MEM, "vmalloc() failed for opcode " "%s", scst_get_opcode_name(cmd));