Re: [PATCH 05/14] saa7164: Check if dev is NULL before dereferencing it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/28/2015 05:43 PM, Mauro Carvalho Chehab wrote:
> As reported by smatch:
> 	drivers/media/pci/saa7164/saa7164-core.c:631 saa7164_irq() warn: variable dereferenced before check 'dev' (see line 621)
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx>

Acked-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>

> 
> diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c
> index 9cf3c6cba498..072dcc8f13d9 100644
> --- a/drivers/media/pci/saa7164/saa7164-core.c
> +++ b/drivers/media/pci/saa7164/saa7164-core.c
> @@ -618,12 +618,7 @@ static irqreturn_t saa7164_irq_ts(struct saa7164_port *port)
>  static irqreturn_t saa7164_irq(int irq, void *dev_id)
>  {
>  	struct saa7164_dev *dev = dev_id;
> -	struct saa7164_port *porta = &dev->ports[SAA7164_PORT_TS1];
> -	struct saa7164_port *portb = &dev->ports[SAA7164_PORT_TS2];
> -	struct saa7164_port *portc = &dev->ports[SAA7164_PORT_ENC1];
> -	struct saa7164_port *portd = &dev->ports[SAA7164_PORT_ENC2];
> -	struct saa7164_port *porte = &dev->ports[SAA7164_PORT_VBI1];
> -	struct saa7164_port *portf = &dev->ports[SAA7164_PORT_VBI2];
> +	struct saa7164_port *porta, *portb, *portc, *portd, *porte, *portf;
>  
>  	u32 intid, intstat[INT_SIZE/4];
>  	int i, handled = 0, bit;
> @@ -634,6 +629,13 @@ static irqreturn_t saa7164_irq(int irq, void *dev_id)
>  		goto out;
>  	}
>  
> +	porta = &dev->ports[SAA7164_PORT_TS1];
> +	portb = &dev->ports[SAA7164_PORT_TS2];
> +	portc = &dev->ports[SAA7164_PORT_ENC1];
> +	portd = &dev->ports[SAA7164_PORT_ENC2];
> +	porte = &dev->ports[SAA7164_PORT_VBI1];
> +	portf = &dev->ports[SAA7164_PORT_VBI2];
> +
>  	/* Check that the hardware is accessible. If the status bytes are
>  	 * 0xFF then the device is not accessible, the the IRQ belongs
>  	 * to another driver.
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux