public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] [media] xc4000: shut up a bogus smatch message
@ 2016-02-22 14:16 Mauro Carvalho Chehab
  2016-02-22 14:16 ` [PATCH 2/5] [media] v4l2-mc: fix hardware version for PCI devices Mauro Carvalho Chehab
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2016-02-22 14:16 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab

smatch complains about:
	drivers/media/tuners/xc4000.c:1511 xc4000_get_signal() warn: '~value << 3' 524280 can't fit into 65535 'value'

Remove the bogus complain.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/tuners/xc4000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/tuners/xc4000.c b/drivers/media/tuners/xc4000.c
index 219ebafae70f..d95c7e082ccf 100644
--- a/drivers/media/tuners/xc4000.c
+++ b/drivers/media/tuners/xc4000.c
@@ -1508,7 +1508,7 @@ static int xc4000_get_signal(struct dvb_frontend *fe, u16 *strength)
 	if (value >= 0x2000) {
 		value = 0;
 	} else {
-		value = ~value << 3;
+		value = (~value << 3) & 0xffff;
 	}
 
 	goto ret;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] [media] v4l2-mc: fix hardware version for PCI devices
  2016-02-22 14:16 [PATCH 1/5] [media] xc4000: shut up a bogus smatch message Mauro Carvalho Chehab
@ 2016-02-22 14:16 ` Mauro Carvalho Chehab
  2016-02-22 14:16 ` [PATCH 3/5] [media] tvp5150: don't go past decoder->input_ent array Mauro Carvalho Chehab
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2016-02-22 14:16 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab

It should be a bitwise or, and not a logical one. Also, add
parenthesis, to make sure it will be applied in the right order.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/v4l2-core/v4l2-mc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c
index a7f41b323522..64eefb9ffb7e 100644
--- a/drivers/media/v4l2-core/v4l2-mc.c
+++ b/drivers/media/v4l2-core/v4l2-mc.c
@@ -40,8 +40,8 @@ struct media_device *v4l2_mc_pci_media_device_init(struct pci_dev *pci_dev,
 
 	sprintf(mdev->bus_info, "PCI:%s", pci_name(pci_dev));
 
-	mdev->hw_revision = pci_dev->subsystem_vendor << 16
-			    || pci_dev->subsystem_device;
+	mdev->hw_revision = (pci_dev->subsystem_vendor << 16)
+			    | pci_dev->subsystem_device;
 
 	mdev->driver_version = LINUX_VERSION_CODE;
 
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] [media] tvp5150: don't go past decoder->input_ent array
  2016-02-22 14:16 [PATCH 1/5] [media] xc4000: shut up a bogus smatch message Mauro Carvalho Chehab
  2016-02-22 14:16 ` [PATCH 2/5] [media] v4l2-mc: fix hardware version for PCI devices Mauro Carvalho Chehab
@ 2016-02-22 14:16 ` Mauro Carvalho Chehab
  2016-02-22 14:21   ` Javier Martinez Canillas
  2016-02-22 14:16 ` [PATCH 4/5] [media] saa7134: fix detection of external decoders Mauro Carvalho Chehab
  2016-02-22 14:16 ` [PATCH 5/5] [media] dib0090: do the right thing if rf_ramp is NULL Mauro Carvalho Chehab
  3 siblings, 1 reply; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2016-02-22 14:16 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Javier Martinez Canillas, Laurent Pinchart,
	Hans Verkuil, Prabhakar Lad

drivers/media/i2c/tvp5150.c:1394 tvp5150_parse_dt() warn: buffer overflow 'decoder->input_ent' 3 <= 3

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/i2c/tvp5150.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index ef393f5daf2a..ff18444e19e4 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -1386,7 +1386,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
 			goto err_connector;
 		}
 
-		if (input_type > TVP5150_INPUT_NUM) {
+		if (input_type >= TVP5150_INPUT_NUM) {
 			ret = -EINVAL;
 			goto err_connector;
 		}
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] [media] saa7134: fix detection of external decoders
  2016-02-22 14:16 [PATCH 1/5] [media] xc4000: shut up a bogus smatch message Mauro Carvalho Chehab
  2016-02-22 14:16 ` [PATCH 2/5] [media] v4l2-mc: fix hardware version for PCI devices Mauro Carvalho Chehab
  2016-02-22 14:16 ` [PATCH 3/5] [media] tvp5150: don't go past decoder->input_ent array Mauro Carvalho Chehab
@ 2016-02-22 14:16 ` Mauro Carvalho Chehab
  2016-02-22 14:16 ` [PATCH 5/5] [media] dib0090: do the right thing if rf_ramp is NULL Mauro Carvalho Chehab
  3 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2016-02-22 14:16 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Andrew Morton, Junghak Sung, Hans Verkuil,
	Geunyoung Kim

As warned by smatch:
	drivers/media/pci/saa7134/saa7134-core.c:840 saa7134_create_entities() info: ignoring unreachable code.
	drivers/media/pci/saa7134/saa7134-core.c:843 saa7134_create_entities() warn: curly braces intended?

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/pci/saa7134/saa7134-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c
index 42bc4172febd..8f3ba4077130 100644
--- a/drivers/media/pci/saa7134/saa7134-core.c
+++ b/drivers/media/pci/saa7134/saa7134-core.c
@@ -838,9 +838,10 @@ static void saa7134_create_entities(struct saa7134_dev *dev)
 
 	/* Check if it is using an external analog TV demod */
 	media_device_for_each_entity(entity, dev->media_dev) {
-		if (entity->function == MEDIA_ENT_F_ATV_DECODER)
+		if (entity->function == MEDIA_ENT_F_ATV_DECODER) {
 			decoder = entity;
 			break;
+		}
 	}
 
 	/*
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] [media] dib0090: do the right thing if rf_ramp is NULL
  2016-02-22 14:16 [PATCH 1/5] [media] xc4000: shut up a bogus smatch message Mauro Carvalho Chehab
                   ` (2 preceding siblings ...)
  2016-02-22 14:16 ` [PATCH 4/5] [media] saa7134: fix detection of external decoders Mauro Carvalho Chehab
@ 2016-02-22 14:16 ` Mauro Carvalho Chehab
  3 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2016-02-22 14:16 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Patrick Boettcher

As warned by smatch:
	drivers/media/dvb-frontends/dib0090.c:1118 dib0090_pwm_gain_reset() error: we previously assumed 'state->rf_ramp' could be null (see line 1086)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/dvb-frontends/dib0090.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/dib0090.c b/drivers/media/dvb-frontends/dib0090.c
index 976ee034a430..7ee784f1b771 100644
--- a/drivers/media/dvb-frontends/dib0090.c
+++ b/drivers/media/dvb-frontends/dib0090.c
@@ -1115,9 +1115,15 @@ void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
 		dib0090_set_bbramp_pwm(state, bb_ramp);
 
 		/* activate the ramp generator using PWM control */
-		dprintk("ramp RF gain = %d BAND = %s version = %d", state->rf_ramp[0], (state->current_band == BAND_CBAND) ? "CBAND" : "NOT CBAND", state->identity.version & 0x1f);
+		if (rf_ramp)
+			dprintk("ramp RF gain = %d BAND = %s version = %d",
+				state->rf_ramp[0],
+				(state->current_band == BAND_CBAND) ? "CBAND" : "NOT CBAND",
+				state->identity.version & 0x1f);
 
-		if ((state->rf_ramp[0] == 0) || (state->current_band == BAND_CBAND && (state->identity.version & 0x1f) <= P1D_E_F)) {
+		if (rf_ramp && ((state->rf_ramp[0] == 0) ||
+		    (state->current_band == BAND_CBAND &&
+		    (state->identity.version & 0x1f) <= P1D_E_F))) {
 			dprintk("DE-Engage mux for direct gain reg control");
 			en_pwm_rf_mux = 0;
 		} else
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/5] [media] tvp5150: don't go past decoder->input_ent array
  2016-02-22 14:16 ` [PATCH 3/5] [media] tvp5150: don't go past decoder->input_ent array Mauro Carvalho Chehab
@ 2016-02-22 14:21   ` Javier Martinez Canillas
  0 siblings, 0 replies; 6+ messages in thread
From: Javier Martinez Canillas @ 2016-02-22 14:21 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Laurent Pinchart,
	Hans Verkuil, Prabhakar Lad

Hello Mauro,

On 02/22/2016 11:16 AM, Mauro Carvalho Chehab wrote:
> drivers/media/i2c/tvp5150.c:1394 tvp5150_parse_dt() warn: buffer overflow 'decoder->input_ent' 3 <= 3
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> ---
>   drivers/media/i2c/tvp5150.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
> index ef393f5daf2a..ff18444e19e4 100644
> --- a/drivers/media/i2c/tvp5150.c
> +++ b/drivers/media/i2c/tvp5150.c
> @@ -1386,7 +1386,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
>   			goto err_connector;
>   		}
>
> -		if (input_type > TVP5150_INPUT_NUM) {
> +		if (input_type >= TVP5150_INPUT_NUM) {
>   			ret = -EINVAL;
>   			goto err_connector;
>   		}
>

Thanks for the fix.

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-22 14:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 14:16 [PATCH 1/5] [media] xc4000: shut up a bogus smatch message Mauro Carvalho Chehab
2016-02-22 14:16 ` [PATCH 2/5] [media] v4l2-mc: fix hardware version for PCI devices Mauro Carvalho Chehab
2016-02-22 14:16 ` [PATCH 3/5] [media] tvp5150: don't go past decoder->input_ent array Mauro Carvalho Chehab
2016-02-22 14:21   ` Javier Martinez Canillas
2016-02-22 14:16 ` [PATCH 4/5] [media] saa7134: fix detection of external decoders Mauro Carvalho Chehab
2016-02-22 14:16 ` [PATCH 5/5] [media] dib0090: do the right thing if rf_ramp is NULL Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox