aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2012-05-02 03:05:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-08 12:42:33 -0400
commit788ab1bb03d304232711b6ca9718534f588ee9fc (patch)
tree473d2473bc8e45c544485913ca3cca31f9355bb2 /drivers/media/video
parentf36c7d9e9d745b3f60f79bdf53f160047c8262c6 (diff)
[media] gspca - sonixj: Fix a zero divide in isoc interrupt
In case of short marker, the number of received packets was not incremented doing a zero divide when computing the filling rate. Reported-by: Hans Petter Selasky <hans.petter.selasky@bitfrost.no> Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/gspca/sonixj.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index db8e5084df06..863c755dd2b7 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -2923,6 +2923,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2923 * not the JPEG end of frame ('ff d9'). 2923 * not the JPEG end of frame ('ff d9').
2924 */ 2924 */
2925 2925
2926 /* count the packets and their size */
2927 sd->npkt++;
2928 sd->pktsz += len;
2929
2926/*fixme: assumption about the following code: 2930/*fixme: assumption about the following code:
2927 * - there can be only one marker in a packet 2931 * - there can be only one marker in a packet
2928 */ 2932 */
@@ -2945,10 +2949,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2945 data += i; 2949 data += i;
2946 } 2950 }
2947 2951
2948 /* count the packets and their size */
2949 sd->npkt++;
2950 sd->pktsz += len;
2951
2952 /* search backwards if there is a marker in the packet */ 2952 /* search backwards if there is a marker in the packet */
2953 for (i = len - 1; --i >= 0; ) { 2953 for (i = len - 1; --i >= 0; ) {
2954 if (data[i] != 0xff) { 2954 if (data[i] != 0xff) {