[media] dvb-usb: improve sanity check of adap->active_fe in dvb_usb_ctrl_feed
authorMichael Krufky <mkrufky@kernellabs.com>
Thu, 8 Sep 2011 04:17:39 +0000 (01:17 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 9 Sep 2011 18:28:04 +0000 (15:28 -0300)
The check for (adap->active_fe < 0) at the top of dvb_usb_ctrl_feed is a sanity
check to ensure that adap->active_fe is valid.  Improve that sanity check
by also checking for (adap->active_fe >= adap->num_frontends_initialized)

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/dvb-usb-dvb.c

index 460b5ae..038679b 100644 (file)
@@ -17,7 +17,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
        if (adap == NULL)
                return -ENODEV;
 
-       if (adap->active_fe < 0) {
+       if ((adap->active_fe < 0) ||
+           (adap->active_fe >= adap->num_frontends_initialized)) {
                return -EINVAL;
        }