From 249b15ba6380830881b7863ca5dd3f33320adfdb Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 2 Dec 2014 14:07:30 +0300 Subject: [PATCH] scsi: set fmt to NULL scsi_extd_sense_format() by default One of the two callers passes an unintialized pointer as "fmt" and expects it to be set to NULL if there is no format string. Let's make this function work as expected. Fixes: d811b848ebb7 ('scsi: use sdev as argument for sense code printing') Signed-off-by: Dan Carpenter Reviewed-by: James Bottomley Signed-off-by: Christoph Hellwig --- drivers/scsi/constants.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index aee62f60b43..e2068a2621c 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1271,6 +1271,7 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt) int i; unsigned short code = ((asc << 8) | ascq); + *fmt = NULL; for (i = 0; additional[i].text; i++) if (additional[i].code12 == code) return additional[i].text; @@ -1282,6 +1283,8 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt) return additional2[i].str; } } +#else + *fmt = NULL; #endif return NULL; } -- 2.46.0