Skip to content

Commit

Permalink
[media] drivers/media/pci/saa7134/saa7134-dvb.c: Test if videobuf_dvb…
Browse files Browse the repository at this point in the history
…_get_frontend return NULL

Based on commit: e66131c
Not testing videobuf_dvb_get_frontend output may cause OOPS if it return
NULL. This patch fixes this issue.
The semantic patch that found this issue is(http://coccinelle.lip6.fr/):
// <smpl>
@@
identifier i,a,b;
statement S, S2;
@@
i = videobuf_dvb_get_frontend(...);
... when != if (!i) S
* if (i->a.b)
S2
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Peter Senna Tschudin authored and Mauro Carvalho Chehab committed Dec 21, 2012
1 parent 832fbb5 commit 37e310e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/pci/saa7134/saa7134-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ static int configure_tda827x_fe(struct saa7134_dev *dev,
/* Get the first frontend */
fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);

if (!fe0)
return -EINVAL;

fe0->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap);
if (fe0->dvb.frontend) {
if (cdec_conf->i2c_gate)
Expand Down

0 comments on commit 37e310e

Please sign in to comment.