Re: [PATCH] scsi: hpsa: fix uninitialized variable access

From: Arnd Bergmann
Date: Tue Nov 22 2016 - 09:50:30 EST


On Tuesday, November 22, 2016 3:47:09 PM CET Hannes Reinecke wrote:
> index 05f7782..ee6f852 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -2031,7 +2031,7 @@ static struct hpsa_scsi_dev_t
> *lookup_hpsa_scsi_dev(struct ctlr_info *h,
>
> static int hpsa_slave_alloc(struct scsi_device *sdev)
> {
> - struct hpsa_scsi_dev_t *sd;
> + struct hpsa_scsi_dev_t *sd = NULL;
> unsigned long flags;
> struct ctlr_info *h;
>
>

I try not to add initializations like this in general, since they
prevent us from finding the bug, but here that seems fine too
as we immediately test it for NULL anyway.

Can you follow up with a patch to do that?

Arnd