From: Michael Krufky Date: Thu, 8 Sep 2011 04:17:39 +0000 (-0300) Subject: [media] dvb-usb: improve sanity check of adap->active_fe in dvb_usb_ctrl_feed X-Git-Tag: MMI-PSA29.97-13-9~18177^2~187 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2d04c13a507f5a01daa7422cd52250809573cfdb;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [media] dvb-usb: improve sanity check of adap->active_fe in dvb_usb_ctrl_feed 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c index 460b5ae1a45d..038679bd4956 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c @@ -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; }