Skip to content

Commit 788ab1b

Browse files
moinejfMauro Carvalho Chehab
authored andcommitted
[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 <[email protected]> Signed-off-by: Jean-François Moine <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent f36c7d9 commit 788ab1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/media/video/gspca/sonixj.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,6 +2923,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
29232923
* not the JPEG end of frame ('ff d9').
29242924
*/
29252925

2926+
/* count the packets and their size */
2927+
sd->npkt++;
2928+
sd->pktsz += len;
2929+
29262930
/*fixme: assumption about the following code:
29272931
* - there can be only one marker in a packet
29282932
*/
@@ -2945,10 +2949,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
29452949
data += i;
29462950
}
29472951

2948-
/* count the packets and their size */
2949-
sd->npkt++;
2950-
sd->pktsz += len;
2951-
29522952
/* search backwards if there is a marker in the packet */
29532953
for (i = len - 1; --i >= 0; ) {
29542954
if (data[i] != 0xff) {

0 commit comments

Comments
 (0)