Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3a9e287 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (13547): radio: add trivial checks on the tuner and type args.



Many radio drivers did not check the tuner and type field correctly
for g/s_frequency. These checks have now been added.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent cda4303f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -268,6 +268,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
{
	struct rtrack *rt = video_drvdata(file);

	if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
		return -EINVAL;
	rt_setfreq(rt, f->frequency);
	return 0;
}
@@ -277,6 +279,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
{
	struct rtrack *rt = video_drvdata(file);

	if (f->tuner != 0)
		return -EINVAL;
	f->type = V4L2_TUNER_RADIO;
	f->frequency = rt->curfreq;
	return 0;
+4 −0
Original line number Diff line number Diff line
@@ -254,6 +254,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
{
	struct aztech *az = video_drvdata(file);

	if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
		return -EINVAL;
	az_setfreq(az, f->frequency);
	return 0;
}
@@ -263,6 +265,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
{
	struct aztech *az = video_drvdata(file);

	if (f->tuner != 0)
		return -EINVAL;
	f->type = V4L2_TUNER_RADIO;
	f->frequency = az->curfreq;
	return 0;
+4 −0
Original line number Diff line number Diff line
@@ -240,6 +240,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
{
	struct gemtek_pci *card = video_drvdata(file);

	if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
		return -EINVAL;
	if (f->frequency < GEMTEK_PCI_RANGE_LOW ||
	    f->frequency > GEMTEK_PCI_RANGE_HIGH)
		return -EINVAL;
@@ -253,6 +255,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
{
	struct gemtek_pci *card = video_drvdata(file);

	if (f->tuner != 0)
		return -EINVAL;
	f->type = V4L2_TUNER_RADIO;
	f->frequency = card->current_frequency;
	return 0;
+4 −0
Original line number Diff line number Diff line
@@ -200,6 +200,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
{
	struct maestro *dev = video_drvdata(file);

	if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
		return -EINVAL;
	if (f->frequency < FREQ_LO || f->frequency > FREQ_HI)
		return -EINVAL;
	mutex_lock(&dev->lock);
@@ -213,6 +215,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
{
	struct maestro *dev = video_drvdata(file);

	if (f->tuner != 0)
		return -EINVAL;
	f->type = V4L2_TUNER_RADIO;
	mutex_lock(&dev->lock);
	f->frequency = BITS2FREQ(radio_bits_get(dev));
+4 −0
Original line number Diff line number Diff line
@@ -262,6 +262,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
{
	struct maxiradio *dev = video_drvdata(file);

	if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
		return -EINVAL;
	if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) {
		dprintk(dev, 1, "radio freq (%d.%02d MHz) out of range (%d-%d)\n",
					f->frequency / 16000,
@@ -285,6 +287,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
{
	struct maxiradio *dev = video_drvdata(file);

	if (f->tuner != 0)
		return -EINVAL;
	f->type = V4L2_TUNER_RADIO;
	f->frequency = dev->freq;

Loading