Prevent read from t_params->ranges[-1].

Signed-off-by: Roel Kluin <roel.kl...@gmail.com>
---
This is only required when t_params->count can be 0, can it?

Roel

diff --git a/drivers/media/common/tuners/tuner-simple.c 
b/drivers/media/common/tuners/tuner-simple.c
index 8abbcc5..e679d5f 100644
--- a/drivers/media/common/tuners/tuner-simple.c
+++ b/drivers/media/common/tuners/tuner-simple.c
@@ -266,7 +266,7 @@ static int simple_config_lookup(struct dvb_frontend *fe,
                        continue;
                break;
        }
-       if (i == t_params->count) {
+       if (i == t_params->count && i) {
                tuner_dbg("frequency out of range (%d > %d)\n",
                          *frequency, t_params->ranges[i - 1].limit);
                *frequency = t_params->ranges[--i].limit;
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to