summaryrefslogtreecommitdiff
path: root/sys/v4l
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-10-31 18:01:49 (GMT)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-12-02 18:04:28 (GMT)
commitd5499f55563b314684393d494b4bb45d9956bf37 (patch)
tree65979cec69548cc5c442b60be848512f2b54d5dd /sys/v4l
parent334a7390838ef9fc784191cd2b8ab25c52a8ddbe (diff)
downloadgst-plugins-base-d5499f55563b314684393d494b4bb45d9956bf37.tar.gz
gst-plugins-base-d5499f55563b314684393d494b4bb45d9956bf37.tar.xz
v4l: If no video tuner is the requested one don't read unitialized data
Diffstat (limited to 'sys/v4l')
-rw-r--r--sys/v4l/v4l_calls.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/v4l/v4l_calls.c b/sys/v4l/v4l_calls.c
index 05613d4..b2b7573 100644
--- a/sys/v4l/v4l_calls.c
+++ b/sys/v4l/v4l_calls.c
@@ -323,22 +323,14 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement)
struct video_tuner vtun;
gint n;
- for (n = 0;; n++) {
- if (n >= vchan.tuners) {
- vtun.tuner = 0; /* default */
- } else {
- vtun.tuner = n;
- if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
- continue; /* no more tuners */
- if (strcmp (vtun.name, vchan.name) != 0) {
- continue; /* not this one */
- }
+ for (n = 0; n < vchan.tuners; n++) {
+ vtun.tuner = n;
+ if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
+ continue; /* no more tuners */
+ if (strcmp (vtun.name, vchan.name) != 0) {
+ continue; /* not this one */
}
- /* FIXME: in the case of n >= vchan.tuners the code below accesses
- * uninitialised fields in vtun
- * Not sure if the codeblock below should go into the else above, but
- * then setting vtun.tuner=0 is a bit pointless.
- */
+
v4lchannel->tuner = n;
channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
channel->freq_multiplicator =