mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
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
1 changed files with 14 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue