All of lore.kernel.org
 help / color / mirror / Atom feed
* exynos4: index out of bounds if no pixelcode found
@ 2013-10-13 10:16 Roel Kluin
  2013-10-13 11:13 ` Sylwester Nawrocki
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2013-10-13 10:16 UTC (permalink / raw)
  To: Kyungmin Park, Sylwester Nawrocki, Mauro Carvalho Chehab,
	Kukjin Kim, linux-media, akpm, linux-kernel

In case no valid pixelcode is found, an i of -1 after the loop is out of 
bounds for the array.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/media/platform/exynos4-is/fimc-lite-reg.c 
b/drivers/media/platform/exynos4-is/fimc-lite-reg.c
index 72a343e3b..d0dc7ee 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite-reg.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite-reg.c
@@ -133,7 +133,7 @@ void flite_hw_set_source_format(struct fimc_lite *dev, 
struct flite_frame *f)
 	int i = ARRAY_SIZE(src_pixfmt_map);
 	u32 cfg;
 
-	while (--i >= 0) {
+	while (--i) {
 		if (src_pixfmt_map[i][0] == pixelcode)
 			break;
 	}
@@ -240,7 +240,7 @@ static void flite_hw_set_out_order(struct fimc_lite 
*dev, struct flite_frame *f)
 	u32 cfg = readl(dev->regs + FLITE_REG_CIODMAFMT);
 	int i = ARRAY_SIZE(pixcode);
 
-	while (--i >= 0)
+	while (--i)
 		if (pixcode[i][0] == f->fmt->mbus_code)
 			break;
 	cfg &= ~FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: exynos4: index out of bounds if no pixelcode found
  2013-10-13 10:16 exynos4: index out of bounds if no pixelcode found Roel Kluin
@ 2013-10-13 11:13 ` Sylwester Nawrocki
  0 siblings, 0 replies; 2+ messages in thread
From: Sylwester Nawrocki @ 2013-10-13 11:13 UTC (permalink / raw)
  To: Roel Kluin
  Cc: Kyungmin Park, Sylwester Nawrocki, Mauro Carvalho Chehab,
	Kukjin Kim, linux-media, akpm, linux-kernel

Hi Roel,

On 10/13/2013 12:16 PM, Roel Kluin wrote:
> In case no valid pixelcode is found, an i of -1 after the loop is out of
> bounds for the array.
>
> Signed-off-by: Roel Kluin<roel.kluin@gmail.com>

Thank you for the fix, I have applied this patch to my tree for 3.13.
However it seems to be mangled (at least line wrapped) and didn't
apply cleanly. The patchwork also didn't catch it properly:
https://patchwork.linuxtv.org/patch/20380/

I'd suggest using git send-email in future.

Thanks,
Sylwester

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-13 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-13 10:16 exynos4: index out of bounds if no pixelcode found Roel Kluin
2013-10-13 11:13 ` Sylwester Nawrocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.