public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
	Steven Toth <stoth@kernellabs.com>,
	Olli Salonen <olli.salonen@iki.fi>
Subject: Re: [PATCH 05/14] saa7164: Check if dev is NULL before dereferencing it
Date: Thu, 30 Apr 2015 08:21:04 +0200	[thread overview]
Message-ID: <5541C9D0.801@xs4all.nl> (raw)
In-Reply-To: <911c4403de95f55f0de9d2768269878a2da77e62.1430235781.git.mchehab@osg.samsung.com>

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@osg.samsung.com>

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

> 
> 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.
> 


  reply	other threads:[~2015-04-30  6:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 15:43 [PATCH 01/14] rc: fix bad indenting Mauro Carvalho Chehab
2015-04-28 15:43 ` [PATCH 02/14] cx18: avoid going past input/audio array Mauro Carvalho Chehab
2015-04-28 23:07   ` Andy Walls
2015-04-28 15:43 ` [PATCH 03/14] saa7134: fix indent issues Mauro Carvalho Chehab
2015-04-30  6:20   ` Hans Verkuil
2015-04-30 14:08     ` Mauro Carvalho Chehab
2015-04-30 14:39       ` Hans Verkuil
2015-04-28 15:43 ` [PATCH 04/14] ngene: preventing dereferencing a NULL pointer Mauro Carvalho Chehab
2015-04-28 15:43 ` [PATCH 05/14] saa7164: Check if dev is NULL before dereferencing it Mauro Carvalho Chehab
2015-04-30  6:21   ` Hans Verkuil [this message]
2015-04-28 15:43 ` [PATCH 06/14] saa717x: fix multi-byte read code Mauro Carvalho Chehab
2015-04-28 15:43 ` [PATCH 07/14] radio-si476x: Fix indent Mauro Carvalho Chehab
2015-04-28 15:43 ` [PATCH 08/14] avoid going past input/audio array Mauro Carvalho Chehab
2015-04-28 23:08   ` Andy Walls
2015-04-28 15:43 ` [PATCH 09/14] zoran: fix indent Mauro Carvalho Chehab
2015-04-30  6:22   ` Hans Verkuil
2015-04-30 10:16   ` Lad, Prabhakar
2015-04-28 15:43 ` [PATCH 10/14] s3c-camif: Check if fmt is NULL before use Mauro Carvalho Chehab
2015-04-29  9:03   ` Sylwester Nawrocki
2015-04-28 15:43 ` [PATCH 11/14] s5p_mfc: remove a dead code Mauro Carvalho Chehab
2015-04-28 15:43 ` [PATCH 12/14] ir-sony-decoder: shutup smatch warnings Mauro Carvalho Chehab
2015-04-28 15:43 ` [PATCH 13/14] wl128x: fix int type for streg_cbdata Mauro Carvalho Chehab
2015-04-28 15:43 ` [PATCH 14/14] qt1010: Reduce text size by using static const Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5541C9D0.801@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=mchehab@osg.samsung.com \
    --cc=olli.salonen@iki.fi \
    --cc=stoth@kernellabs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox