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

Commit 363d79f1 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

[media] tw686x: Don't go past array



Depending on the compiler version, currently it produces the
following warnings:
	tw686x-video.c: In function 'tw686x_video_init':
	tw686x-video.c:65:543: warning: array subscript is above array bounds [-Warray-bounds]

This is actually bogus with the current code, as it currently
hardcodes the framerate to 30 frames/sec, however a potential
use after the array size could happen when the driver adds support
for setting the framerate. So, fix it.

Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 1a2b2c70
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -61,8 +61,17 @@ static unsigned int tw686x_fields_map(v4l2_std_id std, unsigned int fps)
		   8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 0, 0
		   8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 0, 0
	};
	};


	unsigned int i =
	unsigned int i;
		(std & V4L2_STD_625_50) ? std_625_50[fps] : std_525_60[fps];

	if (std & V4L2_STD_525_60) {
		if (fps > ARRAY_SIZE(std_525_60))
			fps = 30;
		i = std_525_60[fps];
	} else {
		if (fps > ARRAY_SIZE(std_625_50))
			fps = 25;
		i = std_625_50[fps];
	}


	return map[i];
	return map[i];
}
}