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: 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>
This commit is contained in:
parent
adb57f60ac
commit
fc3fb43e41
|
@ -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)
|
static int ts_release(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct dvb_device *dvbdev = file->private_data;
|
struct dvb_device *dvbdev = file->private_data;
|
||||||
struct ddb_output *output = dvbdev->priv;
|
struct ddb_output *output = NULL;
|
||||||
struct ddb_input *input = output->port->input[0];
|
struct ddb_input *input = NULL;
|
||||||
|
|
||||||
|
if (dvbdev) {
|
||||||
|
output = dvbdev->priv;
|
||||||
|
input = output->port->input[0];
|
||||||
|
}
|
||||||
|
|
||||||
if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
|
if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
|
||||||
if (!input)
|
if (!input)
|
||||||
|
@ -757,8 +762,13 @@ static int ts_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct dvb_device *dvbdev = file->private_data;
|
struct dvb_device *dvbdev = file->private_data;
|
||||||
struct ddb_output *output = dvbdev->priv;
|
struct ddb_output *output = NULL;
|
||||||
struct ddb_input *input = output->port->input[0];
|
struct ddb_input *input = NULL;
|
||||||
|
|
||||||
|
if (dvbdev) {
|
||||||
|
output = dvbdev->priv;
|
||||||
|
input = output->port->input[0];
|
||||||
|
}
|
||||||
|
|
||||||
if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
|
if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
|
||||||
if (!input)
|
if (!input)
|
||||||
|
|
Loading…
Reference in New Issue