From 022a8a6847f97529a25efa9d690bcdb5e967144f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 6 Feb 2014 13:30:06 +0000 Subject: [PATCH] Hush Coverity warning of scst_ws_push_single_write() uninitialized pointer Coverity warns that sgv may be used uninitialized. The warning applies to WRITE SAME commands with LBDATA == PBDATA == 0 (replicate a single block of user data into the specified LBA range). The warning appears to be spurious - when LBDATA == PBDATA == 0, scst_ws_write_cmd_finished() will not use the uninitialized value saved by scst_ws_push_single_write(). Move initialization of sgv earlier in the function to quiesce the warning. Signed-off-by: Steven J. Magnani git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5266 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 333b5236d..36280480d 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -4645,7 +4645,7 @@ static int scst_ws_push_single_write(struct scst_write_same_priv *wsp, uint8_t write16_cdb[16]; struct scatterlist *sg; int sg_cnt, len = blocks << ws_cmd->dev->block_shift; - struct sgv_pool_obj *sgv; + struct sgv_pool_obj *sgv = NULL; struct scst_cmd *cmd; int64_t cur_lba; @@ -4686,7 +4686,6 @@ static int scst_ws_push_single_write(struct scst_write_same_priv *wsp, goto set_add; } - sgv = NULL; /* we don't supply sgv */ sg = sgv_pool_alloc(ws_cmd->tgt_dev->pool, len, GFP_KERNEL, 0, &sg_cnt, &sgv, &cmd->dev->dev_mem_lim, NULL); if (sg == NULL) {