[media] redrat3: ensure whole packet is read
authorSean Young <sean@mess.org>
Tue, 30 Jul 2013 22:00:00 +0000 (19:00 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Thu, 22 Aug 2013 14:45:32 +0000 (11:45 -0300)
The length in the header excludes the header itself, so we're getting
spurious readings.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/rc/redrat3.c

index 0042367b060cc5b5cf578f1691ce43248a2a4747..ccd267f131fafc6bddb8a85ebe8ff7859fa4b7b2 100644 (file)
@@ -663,7 +663,8 @@ static int redrat3_get_ir_data(struct redrat3_dev *rr3, unsigned len)
                goto out;
        }
 
-       if (rr3->bytes_read < be16_to_cpu(rr3->irdata.header.length))
+       if (rr3->bytes_read < be16_to_cpu(rr3->irdata.header.length) +
+                                               sizeof(struct redrat3_header))
                /* we're still accumulating data */
                return 0;