This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] Guard a divide in v4l1 compat layer
Author:  Dr. David Alan Gilbert <[email protected]>
Date:    Sun Oct 24 13:33:09 2010 -0300

Hi,
  I managed to trigger a divide by 0 in the v4l compat code
with the mem2mem test module; I suspect perhaps it shouldn't
have been returning a 0 pixel wide picture, but either way it seems
right to guard this divide by 0 in the compatibility layer.

Tested on 2.6.36 (ubuntu build, but the code in this is the same as upstream),
but ***not tested with a real video device***.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
cc: stable.kernel.org
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/video/v4l1-compat.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=910f5f05f99c1ffbb484c4e6eb2a460e7a08e2d7

diff --git a/drivers/media/video/v4l1-compat.c 
b/drivers/media/video/v4l1-compat.c
index 0c2105c..d4ac751 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -645,9 +645,16 @@ static noinline long v4l1_compat_get_picture(
                goto done;
        }
 
-       pict->depth   = ((fmt->fmt.pix.bytesperline << 3)
-                        + (fmt->fmt.pix.width - 1))
-                        / fmt->fmt.pix.width;
+       if (fmt->fmt.pix.width)
+       {
+               pict->depth   = ((fmt->fmt.pix.bytesperline << 3)
+                                + (fmt->fmt.pix.width - 1))
+                                / fmt->fmt.pix.width;
+       } else {
+               err = -EINVAL;
+               goto done;
+       }
+
        pict->palette = pixelformat_to_palette(
                fmt->fmt.pix.pixelformat);
 done:

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to