diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2009-03-28 14:35:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:43 -0400 |
commit | e7ddcd98a179c441d54fe84d221cea4e5852b235 (patch) | |
tree | 6df4b8df9d3680ba8b454de80271552dec134c0e /drivers/media/video | |
parent | 997fb78e73f3dce23c6fa773128583e1fa15d164 (diff) |
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 <stoth@linuxtv.org>
Cc: James Edward Geiger <james.e.geiger@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/tuner-core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 2a957e2beabf..421475e0ea59 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, | |||
364 | } | 364 | } |
365 | 365 | ||
366 | t->type = type; | 366 | t->type = type; |
367 | t->config = new_config; | 367 | /* prevent invalid config values */ |
368 | t->config = ((new_config >= 0) && (new_config < 256)) ? new_config : 0; | ||
368 | if (tuner_callback != NULL) { | 369 | if (tuner_callback != NULL) { |
369 | tuner_dbg("defining GPIO callback\n"); | 370 | tuner_dbg("defining GPIO callback\n"); |
370 | t->fe.callback = tuner_callback; | 371 | t->fe.callback = tuner_callback; |