From: Michael Krufky Date: Sat, 28 Mar 2009 18:35:26 +0000 (-0300) Subject: V4L/DVB (11251): tuner: prevent invalid initialization of t->config in set_type X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=e7ddcd98a179c441d54fe84d221cea4e5852b235;p=linux-2.6-omap-h63xx.git V4L/DVB (11251): tuner: prevent invalid initialization of t->config in set_type Drivers that don't set "config" directly in the set_type function will end up with an invalid configuration value. Check that the value is sane, otherwise initialize to 0. Thanks to James Edward Geiger & Steven Toth for reporting this bug. Cc: Steven Toth Cc: James Edward Geiger Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 2a957e2beab..421475e0ea5 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -364,7 +364,8 @@ static void set_type(struct i2c_client *c, unsigned int type, } t->type = type; - t->config = new_config; + /* prevent invalid config values */ + t->config = ((new_config >= 0) && (new_config < 256)) ? new_config : 0; if (tuner_callback != NULL) { tuner_dbg("defining GPIO callback\n"); t->fe.callback = tuner_callback;