Skip to contentSkip to conversation

omap v4l2: fix wrong resizer calculation

PATCH In review Vladimir Pantelic 2 participants 2 messages Jun 17, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 omap v4l2: fix wrong resizer calculation

changes since v1:
reworded the commit message as requested

Quoted 1 line

From f7f1c11fef76e53cdfe4ad98c6c9605dbe94aa86 Mon Sep 17 00:00:00 2001

From: Vladimir Pantelic <[email protected]>
Date: Tue, 26 Apr 2011 09:28:11 +0200
Subject: [PATCH] omap v4l2: fix wrong resizer calculation

The omap_vout_new_crop() function has a possible bug, it uses uninitialized variables "crop.width/height" which are actually output of the function. Instead we should be using "try_crop.width/height" to calculate the resizer values.

---
 drivers/media/video/omap/omap_voutlib.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/video/omap/omap_voutlib.c +3 -3
index 2aa6a76..8ae7481 100644
@@ -193,7 +193,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
 		return -EINVAL;
 
 	if (cpu_is_omap24xx()) {
-		if (crop->height != win->w.height) {
+		if (try_crop.height != win->w.height) {
 			/* If we're resizing vertically, we can't support a
 			 * crop width wider than 768 pixels.
 			 */
@@ -202,7 +202,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
 		}
 	}
 	/* vertical resizing */
-	vresize = (1024 * crop->height) / win->w.height;
+	vresize = (1024 * try_crop.height) / win->w.height;
 	if (cpu_is_omap24xx() && (vresize > 2048))
 		vresize = 2048;
 	else if (cpu_is_omap34xx() && (vresize > 4096))
@@ -221,7 +221,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
 			try_crop.height = 2;
 	}
 	/* horizontal resizing */
-	hresize = (1024 * crop->width) / win->w.width;
+	hresize = (1024 * try_crop.width) / win->w.width;
 	if (cpu_is_omap24xx() && (hresize > 2048))
 		hresize = 2048;
 	else if (cpu_is_omap34xx() && (hresize > 4096))
Signature · 1 line
1.7.6.rc1.1.g2c162b
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Vladimir Pantelic [mailto:[email protected]]
Sent: Friday, June 17, 2011 2:05 PM
To: Kernel development list; [email protected]; Hiremath, Vaibhav
Subject: [PATCH v2] omap v4l2: fix wrong resizer calculation

changes since v1:
reworded the commit message as requested

[Hiremath, Vaibhav] Inline patch please, never submit patch as attachment to the list.

Anyway, I have already applied this patch to my repository.

Thanks,
Vaibhav