From: Daniel Scheller <d.scheller.oss@gmail.com>
To: linux-media@vger.kernel.org, mchehab@kernel.org,
mchehab@s-opensource.com
Cc: r.scobie@clear.net.nz, jasmin@anw.at, d_spingler@freenet.de,
Manfred.Knick@t-online.de, rjkm@metzlerbros.de
Subject: [PATCH v4 05/11] [media] ddbridge: only register frontends in fe2 if fe is not NULL
Date: Sat, 12 Aug 2017 13:55:56 +0200 [thread overview]
Message-ID: <20170812115602.18124-6-d.scheller.oss@gmail.com> (raw)
In-Reply-To: <20170812115602.18124-1-d.scheller.oss@gmail.com>
From: Daniel Scheller <d.scheller@gmx.net>
Smatch reported:
drivers/media/pci/ddbridge/ddbridge-core.c:1602 dvb_input_attach() error: we previously assumed 'dvb->fe' could be null (see line 1595)
dvb->fe2 will ever only be populated when dvb->fe is set. So only handle
registration of dvb->fe2 when dvb->fe got set beforehand by moving the
registration into the "if (dvb->fe)" conditional.
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>
---
drivers/media/pci/ddbridge/ddbridge-core.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index d7bf01f38d98..759a53e82252 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -1506,23 +1506,25 @@ static int dvb_input_attach(struct ddb_input *input)
return 0;
}
dvb->attached = 0x30;
+
if (dvb->fe) {
if (dvb_register_frontend(adap, dvb->fe) < 0)
return -ENODEV;
+
+ if (dvb->fe2) {
+ if (dvb_register_frontend(adap, dvb->fe2) < 0)
+ return -ENODEV;
+ dvb->fe2->tuner_priv = dvb->fe->tuner_priv;
+ memcpy(&dvb->fe2->ops.tuner_ops,
+ &dvb->fe->ops.tuner_ops,
+ sizeof(struct dvb_tuner_ops));
+ }
}
- if (dvb->fe2) {
- if (dvb_register_frontend(adap, dvb->fe2) < 0)
- return -ENODEV;
- dvb->fe2->tuner_priv = dvb->fe->tuner_priv;
- memcpy(&dvb->fe2->ops.tuner_ops,
- &dvb->fe->ops.tuner_ops,
- sizeof(struct dvb_tuner_ops));
- }
+
dvb->attached = 0x31;
return 0;
}
-
static int port_has_encti(struct ddb_port *port)
{
struct device *dev = port->dev->dev;
--
2.13.0
next prev parent reply other threads:[~2017-08-12 11:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-12 11:55 [PATCH v4 00/11] ddbridge: bump to ddbridge-0.9.29 Daniel Scheller
2017-08-12 11:55 ` [PATCH v4 01/11] [media] ddbridge: bump ddbridge code to version 0.9.29 Daniel Scheller
2017-08-12 11:55 ` [PATCH v4 02/11] [media] ddbridge: split I/O related functions off from ddbridge.h Daniel Scheller
2017-08-12 11:55 ` [PATCH v4 03/11] [media] ddbridge: split off hardware definitions and mappings Daniel Scheller
2017-08-12 11:55 ` [PATCH v4 04/11] [media] ddbridge: check pointers before dereferencing Daniel Scheller
2017-08-12 11:55 ` Daniel Scheller [this message]
2017-08-12 11:55 ` [PATCH v4 06/11] [media] ddbridge: fix possible buffer overflow in ddb_ports_init() Daniel Scheller
2017-08-12 11:55 ` [PATCH v4 07/11] [media] ddbridge: remove unreachable code Daniel Scheller
2017-08-12 11:55 ` [PATCH v4 08/11] [media] ddbridge: fix impossible condition warning Daniel Scheller
2017-08-12 11:56 ` [PATCH v4 09/11] [media] ddbridge: fix dereference before check Daniel Scheller
2017-08-12 11:56 ` [PATCH v4 10/11] [media] ddbridge: Kconfig option to control the MSI modparam default Daniel Scheller
2017-08-12 11:56 ` [PATCH v4 11/11] [media] MAINTAINERS: add entry for ddbridge Daniel Scheller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170812115602.18124-6-d.scheller.oss@gmail.com \
--to=d.scheller.oss@gmail.com \
--cc=Manfred.Knick@t-online.de \
--cc=d_spingler@freenet.de \
--cc=jasmin@anw.at \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mchehab@s-opensource.com \
--cc=r.scobie@clear.net.nz \
--cc=rjkm@metzlerbros.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).