Commit fc3fb43e authored by Daniel Scheller's avatar Daniel Scheller Committed by Mauro Carvalho Chehab

media: ddbridge: fix dereference before check

Both ts_release() and ts_open() can use "output" before check (smatch):

  drivers/media/pci/ddbridge/ddbridge-core.c:816 ts_release() warn: variable dereferenced before check 'output' (see line 809)
  drivers/media/pci/ddbridge/ddbridge-core.c:836 ts_open() warn: variable dereferenced before check 'output' (see line 828)

Fix by performing checks on those pointers.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: default avatarDaniel Scheller <d.scheller@gmx.net>
Tested-by: default avatarRichard Scobie <r.scobie@clear.net.nz>
Tested-by: default avatarJasmin Jessich <jasmin@anw.at>
Tested-by: default avatarDietmar Spingler <d_spingler@freenet.de>
Tested-by: default avatarManfred Knick <Manfred.Knick@t-online.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent adb57f60
......@@ -738,8 +738,13 @@ static unsigned int ts_poll(struct file *file, poll_table *wait)
static int ts_release(struct inode *inode, struct file *file)
{
struct dvb_device *dvbdev = file->private_data;
struct ddb_output *output = dvbdev->priv;
struct ddb_input *input = output->port->input[0];
struct ddb_output *output = NULL;
struct ddb_input *input = NULL;
if (dvbdev) {
output = dvbdev->priv;
input = output->port->input[0];
}
if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
if (!input)
......@@ -757,8 +762,13 @@ static int ts_open(struct inode *inode, struct file *file)
{
int err;
struct dvb_device *dvbdev = file->private_data;
struct ddb_output *output = dvbdev->priv;
struct ddb_input *input = output->port->input[0];
struct ddb_output *output = NULL;
struct ddb_input *input = NULL;
if (dvbdev) {
output = dvbdev->priv;
input = output->port->input[0];
}
if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
if (!input)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment