]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] cx23885: Fix some smatch warnings
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 22 Sep 2016 16:37:06 +0000 (13:37 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 22 Sep 2016 16:37:06 +0000 (13:37 -0300)
Make sure that it won't go past the config buffers

drivers/media/pci/cx23885/cx23885-dvb.c:1733 dvb_register() warn: buffer overflow 'netup_xc5000_config' 2 <= s32max
drivers/media/pci/cx23885/cx23885-dvb.c:1745 dvb_register() warn: buffer overflow 'netup_stv0367_config' 2 <= s32max
drivers/media/pci/cx23885/cx23885-dvb.c:1752 dvb_register() warn: buffer overflow 'netup_xc5000_config' 2 <= s32max

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx23885/cx23885.h

index 828b54afd59ee6f7fedd4c8abc464d6e58b337fa..818f3c2fc98d8507317bd99d49f9d2c7717aee91 100644 (file)
@@ -1720,6 +1720,9 @@ static int dvb_register(struct cx23885_tsport *port)
                }
                break;
        case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+               if (port->nr > 2)
+                       return 0;
+
                i2c_bus = &dev->i2c_bus[0];
                mfe_shared = 1;/* MFE */
                port->frontends.gate = 0;/* not clear for me yet */
index 2ebece93d111f2934c605d4586f58bac6da99823..a6735afe22691326740cace9d7672d3659a52ec7 100644 (file)
@@ -257,7 +257,7 @@ struct cx23885_dmaqueue {
 struct cx23885_tsport {
        struct cx23885_dev *dev;
 
-       int                        nr;
+       unsigned                   nr;
        int                        sram_chno;
 
        struct vb2_dvb_frontends   frontends;