summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci
diff options
context:
space:
mode:
authorDaniel Scheller <d.scheller@gmx.net>2017-08-12 07:55:57 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-08-20 07:07:19 -0400
commit8ac9fd4348677cb2ead6776b9f8042c952a3f67c (patch)
treee0c45194d2a38ce578277bc5beab811491b8fb8e /drivers/media/pci
parentf597f2a8fce27b067ed5ad58314bdfbb219d2ffe (diff)
downloadlinux-8ac9fd4348677cb2ead6776b9f8042c952a3f67c.tar.bz2
media: ddbridge: fix possible buffer overflow in ddb_ports_init()
Report from smatch: drivers/media/pci/ddbridge/ddbridge-core.c:2659 ddb_ports_init() error: buffer overflow 'dev->port' 32 <= u32max Fix by making sure "p" is greater than zero before checking for "dev->port[].type == DDB_CI_EXTERNAL_XO2". Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r--drivers/media/pci/ddbridge/ddbridge-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index 759a53e82252..5df942f4e388 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -2551,7 +2551,7 @@ void ddb_ports_init(struct ddb *dev)
port->dvb[0].adap = &dev->adap[2 * p];
port->dvb[1].adap = &dev->adap[2 * p + 1];
- if ((port->class == DDB_PORT_NONE) && i &&
+ if ((port->class == DDB_PORT_NONE) && i && p &&
dev->port[p - 1].type == DDB_CI_EXTERNAL_XO2) {
port->class = DDB_PORT_CI;
port->type = DDB_CI_EXTERNAL_XO2_B;