Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 249b15ba authored by Dan Carpenter's avatar Dan Carpenter Committed by Christoph Hellwig
Browse files

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: d811b848 ('scsi: use sdev as argument for sense code printing')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarJames Bottomley <JBottomley@Parallels.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 85686f69
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1271,6 +1271,7 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
	int i;
	int i;
	unsigned short code = ((asc << 8) | ascq);
	unsigned short code = ((asc << 8) | ascq);


	*fmt = NULL;
	for (i = 0; additional[i].text; i++)
	for (i = 0; additional[i].text; i++)
		if (additional[i].code12 == code)
		if (additional[i].code12 == code)
			return additional[i].text;
			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;
			return additional2[i].str;
		}
		}
	}
	}
#else
	*fmt = NULL;
#endif
#endif
	return NULL;
	return NULL;
}
}