From 88da45bfd08d253a18ff9da603c8d2d02a32609e Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 24 Jan 2018 13:23:17 -0700 Subject: [PATCH] scsi: ensure bdlen is initialized before use This fixes a false positive warning when building on GCC 7.2.1 with CONFIG_COVERAGE=y. bdlen is always initialized on the path where it can be used, but the compiler seems to get confused when coverage is enabled, so zero out the value at the top of the function. Change-Id: Ifc13abff80124cad3d26286ffebf84f967141d13 Reported-by: John Meneghini Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/396244 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/scsi/scsi_bdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scsi/scsi_bdev.c b/lib/scsi/scsi_bdev.c index 1ba5dc755..1cfe8318f 100644 --- a/lib/scsi/scsi_bdev.c +++ b/lib/scsi/scsi_bdev.c @@ -1781,7 +1781,7 @@ spdk_bdev_scsi_process_primary(struct spdk_scsi_task *task) int rc = 0; int pllen, md = 0; int pf, sp; - int bdlen, llba; + int bdlen = 0, llba; int dbd, pc, page, subpage; int cmd_parsed = 0;