]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
firedtv: use length_field() of PMT as length
authorHenrik Kurelid <henrik@kurelid.se>
Fri, 5 Dec 2008 09:00:16 +0000 (10:00 +0100)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Tue, 24 Feb 2009 13:51:28 +0000 (14:51 +0100)
Parsed and used the length_field() of the PMT message instead of using
the length field of the message struct, which does not seem to be filled
correctly by e.g. MythTV.

Signed-off-by: Henrik Kurelid <henrik@kurelid.se>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/media/dvb/firesat/firesat-ci.c

index 0deb47eefa10a39feb644d9461cce16f28956708..783ed2000102de4464613696d9fe5420e4a0d7e6 100644 (file)
@@ -127,14 +127,20 @@ static int firesat_ca_pmt(struct firesat *firesat, void *arg)
 {
        struct ca_msg *msg = arg;
        int data_pos;
+       int data_length;
+       int i;
+
+       data_pos = 4;
+       if (msg->msg[3] & 0x80) {
+               data_length = 0;
+               for (i = 0; i < (msg->msg[3] & 0x7F); i++)
+                       data_length = (data_length << 8) + msg->msg[data_pos++];
+       } else {
+               data_length = msg->msg[3];
+       }
 
-       if (msg->msg[3] & 0x80)
-               data_pos = (msg->msg[4] && 0x7F) + 4;
-       else
-               data_pos = 4;
-
-       return avc_ca_pmt(firesat, &msg->msg[data_pos],
-                         msg->length - data_pos) ? -EFAULT : 0;
+       return avc_ca_pmt(firesat, &msg->msg[data_pos], data_length) ?
+              -EFAULT : 0;
 }
 
 static int firesat_ca_send_msg(struct firesat *firesat, void *arg)