Commit 788ab1bb authored by Jean-François Moine's avatar Jean-François Moine Committed by Mauro Carvalho Chehab

[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: default avatarHans Petter Selasky <hans.petter.selasky@bitfrost.no>
Signed-off-by: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f36c7d9e
...@@ -2923,6 +2923,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -2923,6 +2923,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
* not the JPEG end of frame ('ff d9'). * not the JPEG end of frame ('ff d9').
*/ */
/* count the packets and their size */
sd->npkt++;
sd->pktsz += len;
/*fixme: assumption about the following code: /*fixme: assumption about the following code:
* - there can be only one marker in a packet * - there can be only one marker in a packet
*/ */
...@@ -2945,10 +2949,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -2945,10 +2949,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
data += i; data += i;
} }
/* count the packets and their size */
sd->npkt++;
sd->pktsz += len;
/* search backwards if there is a marker in the packet */ /* search backwards if there is a marker in the packet */
for (i = len - 1; --i >= 0; ) { for (i = len - 1; --i >= 0; ) {
if (data[i] != 0xff) { if (data[i] != 0xff) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment