summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-06-16 18:14:49 -0700
committerTrent Piepho <xyzzy@speakeasy.org>2009-06-16 18:14:49 -0700
commit03d777f511d5820441ae2f3584e7441dd019faea (patch)
tree714fed80250c941783650a4b73e7a91afff35354 /linux/drivers/media/video
parent9204bc59f7e30d4441efb2262a1debc8782b5b74 (diff)
downloadmediapointer-dvb-s2-03d777f511d5820441ae2f3584e7441dd019faea.tar.gz
mediapointer-dvb-s2-03d777f511d5820441ae2f3584e7441dd019faea.tar.bz2
v4l2: Fix flaw in alignment code
From: Trent Piepho <xyzzy@speakeasy.org> It's possible that the height alignment would be increased beyond the maximum possible value when trying to satisfy size alignment. Please fold with b4d3ec8d363d v4l2: Create helper function for bounding and aligning images Priority: high Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r--linux/drivers/media/video/v4l2-common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
index ba3790a98..f94b5d92a 100644
--- a/linux/drivers/media/video/v4l2-common.c
+++ b/linux/drivers/media/video/v4l2-common.c
@@ -1055,10 +1055,13 @@ void v4l_bound_align_image(u32 *w, unsigned int wmin, unsigned int wmax,
if (walign + halign < salign) {
/* Max walign where there is still a valid width */
unsigned int wmaxa = __fls(wmax ^ (wmin - 1));
+ /* Max halign where there is still a valid height */
+ unsigned int hmaxa = __fls(hmax ^ (hmin - 1));
/* up the smaller alignment until we have enough */
do {
- if (walign <= halign && walign < wmaxa) {
+ if (halign >= hmaxa ||
+ (walign <= halign && walign < wmaxa)) {
*w = clamp_align(*w, wmin, wmax, walign + 1);
walign = __ffs(*w);
} else {