Re: [PATCH] [media] v4l2-common: fix overflow in v4l_bound_align_image()

2014-09-10 Thread Sakari Ailus
Hi Maciej, Thanks for the patch! On Tue, Sep 09, 2014 at 05:16:41PM +0200, Maciej Matraszek wrote: > diff --git a/drivers/media/v4l2-core/v4l2-common.c > b/drivers/media/v4l2-core/v4l2-common.c > index ccaa38f65cf1..506cf8b7763b 100644 > --- a/drivers/media/v4l2-core/v4l2-common.c > +++ b/driver

[PATCH] [media] v4l2-common: fix overflow in v4l_bound_align_image()

2014-09-09 Thread Maciej Matraszek
Fix clamp_align() used in v4l_bound_align_image() to prevent overflow when passed large value like UINT32_MAX. In the current implementation: clamp_align(UINT32_MAX, 8, 8192, 3) returns 8, because in line: x = (x + (1 << (align - 1))) & mask; x overflows to (-1 + 4) & 0x7 = 3, while expecte