[media] pvrusb2: don't go past buf array
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 22 Feb 2016 16:22:35 +0000 (13:22 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 23 Feb 2016 10:20:47 +0000 (07:20 -0300)
That fixes the following smatch warning:
drivers/media/usb/pvrusb2/pvrusb2-hdw.c:4909 pvr2_hdw_state_log_state() error: buffer overflow 'buf' 256 <= 4294967294

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/pvrusb2/pvrusb2-hdw.c

index 0533ef20decfe5862716899fffcedf9bbaf756d4..1a093e5953fd3245cce7c13d0360c714e50ca2b1 100644 (file)
@@ -4903,6 +4903,9 @@ static void pvr2_hdw_state_log_state(struct pvr2_hdw *hdw)
                printk(KERN_INFO "%s %.*s\n",hdw->name,ccnt,buf);
        }
        ccnt = pvr2_hdw_report_clients(hdw, buf, sizeof(buf));
+       if (ccnt >= sizeof(buf))
+               ccnt = sizeof(buf);
+
        ucnt = 0;
        while (ucnt < ccnt) {
                lcnt = 0;
This page took 0.028275 seconds and 5 git commands to generate.