Re: [media] duplicate code in media drivers

2018-05-22 Thread Gustavo A. R. Silva
On 05/21/2018 03:44 PM, Devin Heitmueller wrote: diff -u -p drivers/media/dvb-frontends/au8522_decoder.c /tmp/nothing/media/dvb-frontends/au8522_decoder.c --- drivers/media/dvb-frontends/au8522_decoder.c +++ /tmp/nothing/media/dvb-frontends/au8522_decoder.c @@ -280,14 +280,9 @@ static void

[PATCH] au8522: remove duplicate code

2018-05-22 Thread Gustavo A. R. Silva
-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/dvb-frontends/au8522_decoder.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c index 3

Re: [media] duplicate code in media drivers

2018-05-22 Thread Gustavo A. R. Silva
Mauro, I already sent some patches based on your comments. Thanks! -- Gustavo On 05/21/2018 03:14 PM, Mauro Carvalho Chehab wrote: Em Mon, 21 May 2018 14:39:51 -0500 "Gustavo A. R. Silva" <gust...@embeddedor.com> escreveu: Hi Mauro, I found some duplicate code with the he

[PATCH] media: dib0700: add code comment

2018-05-22 Thread Gustavo A. R. Silva
Add FIXME code comment: /* FIXME: check if it is fe_adap[1] */ It is likely that it should be adap->fe_adap[1].fe in the second clause, but this has never been verified. Suggested-by: Mauro Carvalho Chehab <mche...@kernel.org> Signed-off-by: Gustavo A. R. Silva <gust...@em

[PATCH] media: dvb-bt8xx: remove duplicate code

2018-05-22 Thread Gustavo A. R. Silva
The same code is executed regardless of whether c->frequency < 6 or c->frequency < 73000 is true. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/pci/bt8xx/dvb-bt8xx.c | 4

[media] duplicate code in media drivers

2018-05-21 Thread Gustavo A. R. Silva
Hi Mauro, I found some duplicate code with the help of Coccinelle and Coverity. Notice that these are not code patches, they only point out the duplicate code in some media drivers: diff -u -p drivers/media/pci/bt8xx/dvb-bt8xx.c /tmp/nothing/media/pci/bt8xx/dvb-bt8xx.c ---

[PATCH] media: si470x: fix potential Spectre variant 1

2018-05-21 Thread Gustavo A. R. Silva
kernel=152449131114778=2 Cc: sta...@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/radio/si470x/radio-si470x-common.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-05-21 Thread Gustavo A. R. Silva
On 05/17/2018 01:08 PM, Gustavo A. R. Silva wrote: BTW, Mauro, you sent a patch to fix an spectre v1 issue in this file yesterday: dvb_ca_en50221.c:1480, but it seems there is another instance of the same issue some lines above: diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-05-17 Thread Gustavo A. R. Silva
On 05/17/2018 07:13 AM, Mauro Carvalho Chehab wrote: Em Thu, 17 May 2018 08:43:24 -0300 Mauro Carvalho Chehab escreveu: On 05/15/2018 02:39 PM, Dan Carpenter wrote: You'd need to rebuild the db (possibly twice but definitely once). How? Here, I just pull

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-05-17 Thread Gustavo A. R. Silva
On 05/16/2018 08:14 PM, Gustavo A. R. Silva wrote: On 05/15/2018 02:39 PM, Dan Carpenter wrote: Dan, These are all the Spectre media issues I see smatch is reporting in linux-next-20180515: drivers/media/cec/cec-pin-error-inj.c:170 cec_pin_error_inj_parse_line() warn: potential spectre

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-05-16 Thread Gustavo A. R. Silva
On 05/15/2018 02:39 PM, Dan Carpenter wrote: Dan, These are all the Spectre media issues I see smatch is reporting in linux-next-20180515: drivers/media/cec/cec-pin-error-inj.c:170 cec_pin_error_inj_parse_line() warn: potential spectre issue 'pin->error_inj_args'

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-05-15 Thread Gustavo A. R. Silva
On 05/15/2018 09:16 AM, Dan Carpenter wrote: I'm curious about how you finally resolved to handle these issues. I noticed Smatch is no longer reporting them. There was no direct fix for it, but maybe this patch has something to do with the smatch error report cleanup: commit

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-05-14 Thread Gustavo A. R. Silva
Hi Mauro, On 04/26/2018 06:42 PM, Mauro Carvalho Chehab wrote: I noticed you changed the status of this series from rejected to new. Yes. Also, there are other similar issues in media/pci/ Well, the issues will be there everywhere on all media drivers. I marked your patches because I

Re: [PATCH][next] media: ispstat: don't dereference user_cfg before a null check

2018-04-30 Thread Gustavo A. R. Silva
Hi Sakari, On 04/30/2018 10:15 AM, Sakari Ailus wrote: Isn't there a guarantee that new_buf won't be NULL ? The new_buf pointer comes from the parg variable in video_usercopy(), which should always point to a valid buffer given that the ioctl number specifies a non-zero size. Fair question.

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-04-26 Thread Gustavo A. R. Silva
Hi Mauro, On 04/23/2018 02:17 PM, Mauro Carvalho Chehab wrote: Em Mon, 23 Apr 2018 14:11:02 -0500 Thanks, I 'll mark this series as rejected at patchwork.linuxtv.org. Please feel free to resubmit any patch if they represent a real threat, adding a corresponding description about the threat

[PATCH] omap3isp: ispstat: fix potential NULL pointer dereference

2018-04-24 Thread Gustavo A. R. Silva
y: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/omap3isp/ispstat.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c index 0b31f6c..549c7ab 100644 ---

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
On 04/23/2018 02:17 PM, Mauro Carvalho Chehab wrote: Em Mon, 23 Apr 2018 14:11:02 -0500 "Gustavo A. R. Silva" <gust...@embeddedor.com> escreveu: On 04/23/2018 01:24 PM, Mauro Carvalho Chehab wrote: Em Mon, 23 Apr 2018 12:38:03 -0500 "Gustavo A. R. Silva" <gus

Re: [PATCH 00/11] fix potential Spectre variant 1 issues

2018-04-23 Thread Gustavo A. R. Silva
Hi, Please, drop this series. Further analysis is required as it seems all these are False Positives. Sorry for the noise. Thanks -- Gustavo On 04/23/2018 12:37 PM, Gustavo A. R. Silva wrote: This patchset aims to fix various media platform and media usb cases where we have user controlled

Re: [PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
On 04/23/2018 01:24 PM, Mauro Carvalho Chehab wrote: Em Mon, 23 Apr 2018 12:38:03 -0500 "Gustavo A. R. Silva" <gust...@embeddedor.com> escreveu: f->index can be controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerabili

[PATCH 07/11] rcar_drif: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
ported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/rcar_drif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_dr

[PATCH 05/11] omap_vout: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/omap/omap_vout.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_

[PATCH 10/11] vivid-sdr-cap: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
c: sta...@vger.kernel.org Reported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/vivid/vivid-sdr-cap.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/platform/vivid/vivid-sdr-cap.

[PATCH 09/11] vimc-debayer: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
=2 Cc: sta...@vger.kernel.org Reported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/vimc/vimc-debayer.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/v

[PATCH 06/11] rcar-v4l2: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
el.org Reported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.

[PATCH 08/11] sh_vou: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
y: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/sh_vou.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 4dccf29..58d8645 10

[PATCH 04/11] marvell-ccic: mcam-core: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
c: sta...@vger.kernel.org Reported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/marvell-ccic/mcam-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/marvell-ccic/mcam

[PATCH 01/11] media: tm6000: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
ported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/usb/tm6000/tm6000-video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm

[PATCH 11/11] vsp1_rwpf: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
ported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/vsp1/vsp1_rwpf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rw

[PATCH 03/11] fsl-viu: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
penter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/fsl-viu.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c index e4151

[PATCH 02/11] exynos4-is: mipi-csis: fix potential Spectre variant 1

2018-04-23 Thread Gustavo A. R. Silva
c: sta...@vger.kernel.org Reported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/exynos4-is/mipi-csis.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4

[PATCH 00/11] fix potential Spectre variant 1 issues

2018-04-23 Thread Gustavo A. R. Silva
the speculation on the first load and not worry if it can be completed with a dependent load/store [1]. [1] https://marc.info/?l=linux-kernel=152449131114778=2 Thanks Gustavo A. R. Silva (11): media: tm6000: fix potential Spectre variant 1 exynos4-is: mipi-csis: fix potential Spectre variant

[PATCH] staging: media: davinci_vpfe: fix spin_lock/unlock imbalance

2018-04-18 Thread Gustavo A. R. Silva
rk") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/staging/media/davinci_vpfe/dm365_resizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resize

Re: [PATCH 3/3] media: i2c: tvp5150: Use parentheses for sizeof

2018-04-02 Thread Gustavo A. R. Silva
Hi, On 04/02/2018 02:59 PM, Nasser Afshin wrote: This patch resolves a checkpatch.pl warning It would be nice if you explicitly mention the warning. Thanks. -- Gustavo Signed-off-by: Nasser Afshin --- drivers/media/i2c/tvp5150.c | 2 +- 1 file changed, 1

[PATCH] staging/imx: Fix inconsistent IS_ERR and PTR_ERR

2018-02-28 Thread Gustavo A. R. Silva
Fix inconsistent IS_ERR and PTR_ERR in imx_csi_probe. The proper pointer to be passed as argument is pinctrl instead of priv->vdev. This issue was detected with the help of Coccinelle. Fixes: 52e17089d185 ("media: imx: Don't initialize vars that won't be used") Signed-off-by: Gustav

Re: [PATCH] staging: imx-media-vdic: fix inconsistent IS_ERR and PTR_ERR

2018-02-19 Thread Gustavo A. R. Silva
Hi Philipp, On 02/19/2018 08:23 AM, Philipp Zabel wrote: Hi Gustavo, On Wed, 2018-02-14 at 14:57 -0600, Gustavo A. R. Silva wrote: Hi all, I was just wondering about the status of this patch. It is en route as commit dcd71a9292b1 ("staging: imx-media-vdic: fix inconsistent I

Re: [PATCH v3 4/8] i2c: ov9650: use 64-bit arithmetic instead of 32-bit

2018-02-15 Thread Gustavo A. R. Silva
On 02/15/2018 07:52 AM, Hans Verkuil wrote: On 08/02/18 17:39, Gustavo A. R. Silva wrote: Hi Sakari, On 02/07/2018 03:59 PM, Sakari Ailus wrote: Hi Gustavo, On Tue, Feb 06, 2018 at 10:47:50AM -0600, Gustavo A. R. Silva wrote: Add suffix ULL to constants 1 and 100 in order to give

Re: [PATCH] staging: imx-media-vdic: fix inconsistent IS_ERR and PTR_ERR

2018-02-14 Thread Gustavo A. R. Silva
Hi all, I was just wondering about the status of this patch. Thanks -- Gustavo On 01/24/2018 06:14 PM, Steve Longerbeam wrote: Acked-by: Steve Longerbeam <steve_longerb...@mentor.com> On 01/23/2018 04:43 PM, Gustavo A. R. Silva wrote: Fix inconsistent IS_ERR and P

Re: [PATCH v3 4/8] i2c: ov9650: use 64-bit arithmetic instead of 32-bit

2018-02-08 Thread Gustavo A. R. Silva
Hi Sakari, On 02/07/2018 03:59 PM, Sakari Ailus wrote: Hi Gustavo, On Tue, Feb 06, 2018 at 10:47:50AM -0600, Gustavo A. R. Silva wrote: Add suffix ULL to constants 1 and 100 in order to give the compiler complete information about the proper arithmetic to use. Notice

[PATCH v3 3/8] i2c: max2175: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
using 32-bit arithmetic. Addresses-Coverity-ID: 1446589 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix LL to constant in

[PATCH v3 2/8] dvb-frontends: ves1820: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 200604 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix ULL to const

[PATCH v3 4/8] i2c: ov9650: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
onger needed. Addresses-Coverity-ID: 1324146 ("Unintentional integer overflow") Fixes: 84a15ded76ec ("[media] V4L: Add driver for OV9650/52 image sensors") Fixes: 79211c8ed19c ("remove abs64()") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes

Re: [PATCH v2 8/8] platform: vivid-cec: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
Quoting Hans Verkuil <hverk...@xs4all.nl>: On 02/05/18 22:54, Gustavo A. R. Silva wrote: Hi Hans, Quoting Hans Verkuil <hverk...@xs4all.nl>: On 02/05/2018 09:36 PM, Gustavo A. R. Silva wrote: Add suffix ULL to constant 10 in order to give the compiler complete information abou

[PATCH v3 8/8] platform: vivid-cec: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
evaluated using 32-bit arithmetic. Also, remove unnecessary parentheses and add a code comment to make it clear what is the reason of the code change. Addresses-Coverity-ID: 1454996 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> -

[PATCH v3 7/8] platform: sh_veu: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
l integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Move the expression (((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3) at the end in or

[PATCH v3 6/8] rockchip/rga: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
intentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code change. Changes in v3: - Mention the specific Coverity report in the commit message. drivers/media/platform/

[PATCH v3 5/8] pci: cx88-input: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
ted using 32-bit arithmetic. Addresses-Coverity-ID: 1392628 ("Unintentional integer overflow") Addresses-Coverity-ID: 1392630 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog t

[PATCH v3 1/8] rtl2832: use 64-bit arithmetic instead of 32-bit in rtl2832_set_frontend

2018-02-06 Thread Gustavo A. R. Silva
ing 32-bit arithmetic. Addresses-Coverity-ID: 1271223 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix ULL to constant instead

[PATCH v3 0/8] use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
nges in v3: - Mention the specific Coverity report in all commit messages. Gustavo A. R. Silva (8): rtl2832: use 64-bit arithmetic instead of 32-bit in rtl2832_set_frontend dvb-frontends: ves1820: use 64-bit arithmetic instead of 32-bit i2c: max2175: use 64-bit arithmetic instead of 32

Re: [PATCH v2 8/8] platform: vivid-cec: use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
Hi Hans, Quoting Hans Verkuil <hverk...@xs4all.nl>: On 02/05/2018 09:36 PM, Gustavo A. R. Silva wrote: Add suffix ULL to constant 10 in order to give the compiler complete information about the proper arithmetic to use. Notice that this constant is used in a context that expects an expr

[PATCH v2 8/8] platform: vivid-cec: use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
evaluated using 32-bit arithmetic. Also, remove unnecessary parentheses and add a code comment to make it clear what is the reason of the code change. Addresses-Coverity-ID: 1454996 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to

[PATCH v2 7/8] platform: sh_veu: use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
arithmetic. Also, move the expression (((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3) at the end in order to avoid a line wrapping checkpatch.pl warning. Addresses-Coverity-ID: 1056807 Addresses-Coverity-ID: 1056808 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com>

[PATCH v2 6/8] rockchip/rga: use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
ed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code change. drivers/media/platform/rockchip/rga/rga-buf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rock

[PATCH v2 2/8] dvb-frontends: ves1820: use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 200604 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix ULL to constant instead of casting a variable. drive

[PATCH v2 5/8] pci: cx88-input: use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
ted using 32-bit arithmetic. Addresses-Coverity-ID: 1392628 Addresses-Coverity-ID: 1392630 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix LL to constant instead o

[PATCH v2 4/8] i2c: ov9650: use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
onger needed. Addresses-Coverity-ID: 1324146 ("Unintentional integer overflow") Fixes: 84a15ded76ec ("[media] V4L: Add driver for OV9650/52 image sensors") Fixes: 79211c8ed19c ("remove abs64()") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes

[PATCH v2 3/8] i2c: max2175: use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
using 32-bit arithmetic. Addresses-Coverity-ID: 1446589 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix LL to constant instead of casting a variable. drivers/media/i2c/m

[PATCH v2 1/8] rtl2832: use 64-bit arithmetic instead of 32-bit in rtl2832_set_frontend

2018-02-05 Thread Gustavo A. R. Silva
ing 32-bit arithmetic. Addresses-Coverity-ID: 1271223 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Update subject and changelog to better reflect the proposed code changes. - Add suffix ULL to constant instead of casting a variable. drivers/media/d

[PATCH v2 0/8] use 64-bit arithmetic instead of 32-bit

2018-02-05 Thread Gustavo A. R. Silva
and changelog to better reflect the proposed code changes. - Add suffix ULL and LL to constants instead of casting variables. - Extend the proposed code changes to other similar cases that had not previously been considered in v1 of this patchset. Gustavo A. R. Silva (8): rtl2832: use 64-bit

Re: [PATCH 8/8] platform: vivid-cec: fix potential integer overflow in vivid_cec_pin_adap_events

2018-01-30 Thread Gustavo A. R. Silva
Quoting Hans Verkuil <hverk...@xs4all.nl>: On 01/30/18 12:43, Gustavo A. R. Silva wrote: Quoting Hans Verkuil <hverk...@xs4all.nl>: [...] What happens if you do: ((u64)CEC_TIM_START_BIT_TOTAL + I think that forces everything else in the expression to be evaluated as

Re: [PATCH 8/8] platform: vivid-cec: fix potential integer overflow in vivid_cec_pin_adap_events

2018-01-30 Thread Gustavo A. R. Silva
Quoting Hans Verkuil : [...] What happens if you do: ((u64)CEC_TIM_START_BIT_TOTAL + I think that forces everything else in the expression to be evaluated as u64. Well, in this case the operator precedence takes place and the expression len * 10 *

Re: [PATCH 8/8] platform: vivid-cec: fix potential integer overflow in vivid_cec_pin_adap_events

2018-01-30 Thread Gustavo A. R. Silva
Quoting Hans Verkuil <hverk...@xs4all.nl>: On 01/30/2018 09:51 AM, Gustavo A. R. Silva wrote: Hi Hans, Quoting Hans Verkuil <hverk...@xs4all.nl>: Hi Gustavo, On 01/30/2018 01:33 AM, Gustavo A. R. Silva wrote: Cast len to const u64 in order to avoid a potential inte

Re: [PATCH 8/8] platform: vivid-cec: fix potential integer overflow in vivid_cec_pin_adap_events

2018-01-30 Thread Gustavo A. R. Silva
Hi Hans, Quoting Hans Verkuil <hverk...@xs4all.nl>: Hi Gustavo, On 01/30/2018 01:33 AM, Gustavo A. R. Silva wrote: Cast len to const u64 in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type const u64. Addresses-Co

[PATCH 7/8] platform: sh_veu: fix potential integer overflow in sh_veu_colour_offset

2018-01-29 Thread Gustavo A. R. Silva
ntional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/sh_veu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c index 976ea0b..e2795d0

[PATCH 5/8] pci: cx88-input: fix potential integer overflow

2018-01-29 Thread Gustavo A. R. Silva
l integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/pci/cx88/cx88-input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c index 4e9953e..096b3

[PATCH 4/8] i2c: ov9650: fix potential integer overflow in __ov965x_set_frame_interval

2018-01-29 Thread Gustavo A. R. Silva
Cast fi->interval.numerator to u64 in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type u64. Addresses-Coverity-ID: 1324146 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust..

[PATCH 8/8] platform: vivid-cec: fix potential integer overflow in vivid_cec_pin_adap_events

2018-01-29 Thread Gustavo A. R. Silva
Cast len to const u64 in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type const u64. Addresses-Coverity-ID: 1454996 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com&

[PATCH 1/8] rtl2832: fix potential integer overflow in rtl2832_set_frontend

2018-01-29 Thread Gustavo A. R. Silva
Cast dev->pdata->clk to u64 in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type u64. Addresses-Coverity-ID: 1271223 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedo

[PATCH 0/8] fix potential integer overflows

2018-01-29 Thread Gustavo A. R. Silva
8, 1271223, 1324146, 1392628, 1392630, 1446589, 1454996, 1458347. Thank you Gustavo A. R. Silva (8): rtl2832: fix potential integer overflow dvb-frontends: ves1820: fix potential integer overflow i2c: max2175: fix potential integer overflow in max2175_set_nco_freq i2c: ov9650: fix potenti

[PATCH 2/8] dvb-frontends: ves1820: fix potential integer overflow

2018-01-29 Thread Gustavo A. R. Silva
Cast state->config->xin to u64 in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type u64. Addresses-Coverity-ID: 200604 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedo

[PATCH 6/8] rockchip/rga: fix potential integer overflow in rga_buf_map

2018-01-29 Thread Gustavo A. R. Silva
Cast p to dma_addr_t in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type dma_addr_t (u64). Addresses-Coverity-ID: 1458347 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@e

[PATCH 3/8] i2c: max2175: fix potential integer overflow in max2175_set_nco_freq

2018-01-29 Thread Gustavo A. R. Silva
Cast expression (clock_rate - abs_nco_freq) to s64 in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type s64. Addresses-Coverity-ID: 1446589 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. S

Re: [PATCH] staging: imx-media-vdic: fix inconsistent IS_ERR and PTR_ERR

2018-01-25 Thread Gustavo A. R. Silva
Quoting Arnd Bergmann <a...@arndb.de>: On Wed, Jan 24, 2018 at 1:43 AM, Gustavo A. R. Silva <gust...@embeddedor.com> wrote: Fix inconsistent IS_ERR and PTR_ERR in vdic_get_ipu_resources. The proper pointer to be passed as argument is ch. This issue was detected with the help o

[PATCH] staging: imx-media-vdic: fix inconsistent IS_ERR and PTR_ERR

2018-01-23 Thread Gustavo A. R. Silva
Fix inconsistent IS_ERR and PTR_ERR in vdic_get_ipu_resources. The proper pointer to be passed as argument is ch. This issue was detected with the help of Coccinelle. Fixes: 0b2e9e7947e7 ("media: staging/imx: remove confusing IS_ERR_OR_NULL usage") Signed-off-by: Gustavo A. R. S

[PATCH] venus: hfi: use true for boolean values

2018-01-23 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/platform/qcom/venus/hfi_msgs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 del

[PATCH] ov13858: Use false for boolean value

2018-01-23 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/i2c/ov13858.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d

Re: [PATCH] au0828: fix use-after-free at USB probing

2017-12-12 Thread Gustavo A. R. Silva
Hey Andrey, Quoting Andrey Konovalov <andreyk...@google.com>: On Thu, Nov 23, 2017 at 2:31 AM, Gustavo A. R. Silva <garsi...@embeddedor.com> wrote: Hi Andrey, I have successfully installed and tested syzkaller with QEMU. Can you please tell me how to reproduce this bug or s

Re: [git:media_tree/master] media: davinci: vpif_capture: add NULL check on devm_kzalloc return value

2017-12-08 Thread Gustavo A. R. Silva
Quoting Mauro Carvalho Chehab <mche...@s-opensource.com>: This is an automatic generated email to let you know that the following patch were queued: Subject: media: davinci: vpif_capture: add NULL check on devm_kzalloc return value Author: Gustavo A. R. Silva <garsi...@embed

Re: [PATCH] c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt

2017-12-05 Thread Gustavo A. R. Silva
Hello, On 11/21/2017 02:22 AM, Patrice CHOTARD wrote: Hi Gustavo On 11/20/2017 03:00 PM, Gustavo A. R. Silva wrote: _channel_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after _channel_ has

[PATCH] davinci: vpif_capture: add NULL check on devm_kzalloc return value

2017-11-22 Thread Gustavo A. R. Silva
Check return value from call to devm_kzalloc() in order to prevent a NULL pointer dereference. This issue was detected with the help of Coccinelle. Fixes: 4a5f8ae50b66 ("[media] davinci: vpif_capture: get subdevs from DT when available") Signed-off-by: Gustavo A. R. Si

Re: [PATCH] au0828: fix use-after-free at USB probing

2017-11-22 Thread Gustavo A. R. Silva
Hi Andrey, I have successfully installed and tested syzkaller with QEMU. Can you please tell me how to reproduce this bug or share with me the full crash report? Also, can you point me out to the PoC file? Much appreciated Thank you! -- Gustavo A. R. Silva Quoting Andrey Konovalov

Re: [PATCH] c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt

2017-11-22 Thread Gustavo A. R. Silva
On 11/21/2017 02:22 AM, Patrice CHOTARD wrote: Hi Gustavo On 11/20/2017 03:00 PM, Gustavo A. R. Silva wrote: _channel_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after _channel_ has been null

[PATCH] c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt

2017-11-20 Thread Gustavo A. R. Silva
iH407/10 Linux DVB demux support") Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/driver

[PATCH] usb: uvc_debugfs: remove unnecessary NULL check before debugfs_remove_recursive

2017-11-12 Thread Gustavo A. R. Silva
NULL check before freeing functions like debugfs_remove_recursive is not needed. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/media/usb/uvc/uvc_debugfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 del

Re: [PATCH] au0828: fix use-after-free at USB probing

2017-11-10 Thread Gustavo A. R. Silva
Quoting Andrey Konovalov <andreyk...@google.com>: On Fri, Nov 10, 2017 at 1:21 AM, Gustavo A. R. Silva <garsi...@embeddedor.com> wrote: Hi Andrey, Could you please try this patch? Thank you Hi Gustavo, With your patch I get a different crash. Not sure if it's another bug or

[PATCH] au0828: fix use-after-free at USB probing

2017-11-09 Thread Gustavo A. R. Silva
where _dev_ is also freed. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/media/usb/au0828/au0828-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index c

[PATCH] usb: dvb-usb-v2: dvb_usb_core: remove redundant code in dvb_usb_fe_sleep

2017-11-06 Thread Gustavo A. R. Silva
Check on return value and goto instruction is redundant as the code that follows is the goto label err. Addresses-Coverity-ID: 1268783 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 del

[PATCH] st-hva: hva-h264: use swap macro in hva_h264_encode

2017-10-29 Thread Gustavo A. R. Silva
Make use of the swap macro and remove unnecessary variable tmp_frame. This makes the code easier to read and maintain. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/media/platform/sti/hva/hva-h264.c | 5 +

[PATCH] staging: media: imx: fix inconsistent IS_ERR and PTR_ERR

2017-10-17 Thread Gustavo A. R. Silva
Fix inconsistent IS_ERR and PTR_ERR in csi_link_validate. The proper pointer to be passed as argument is sensor. This issue was detected with the help of Coccinelle. Reported-by: Julia Lawall <julia.law...@lip6.fr> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> -

[PATCH] ov9655: fix potential integer overflow

2017-09-19 Thread Gustavo A. R. Silva
Add suffix ULL to constant 1 rather than casting the result of the operation in order to avoid a potential integer overflow. This constant is used in a context that expects an expression of type u64. Addresses-Coverity-ID: 1324146 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.

[PATCH] siano: fix a potential integer overflow

2017-09-19 Thread Gustavo A. R. Silva
Add suffix ULL to constant 65535 in order to avoid a potential integer overflow. This constant is used in a context that expects an expression of type u64. Addresses-Coverity-ID: 1056806 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/common/siano/smsdvb-main

Re: [PATCH v2] venus: fix copy/paste error in return_buf_error

2017-08-22 Thread Gustavo A. R. Silva
On 08/21/2017 04:14 AM, Stanimir Varbanov wrote: Thanks Gustavo! Glad to help. :) On 08/18/2017 07:07 PM, Gustavo A. R. Silva wrote: Call function v4l2_m2m_dst_buf_remove_by_buf() instead of v4l2_m2m_src_buf_remove_by_buf() Addresses-Coverity-ID: 1415317 Cc: Stanimir Varbanov

[PATCH v2] venus: fix copy/paste error in return_buf_error

2017-08-18 Thread Gustavo A. R. Silva
Call function v4l2_m2m_dst_buf_remove_by_buf() instead of v4l2_m2m_src_buf_remove_by_buf() Addresses-Coverity-ID: 1415317 Cc: Stanimir Varbanov <stanimir.varba...@linaro.org> Cc: Hans Verkuil <hverk...@xs4all.nl> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com>

Re: [PATCH] media: venus: fix duplicated code for different branches

2017-08-18 Thread Gustavo A. R. Silva
Hi Stanimir, On 08/18/2017 02:52 AM, Stanimir Varbanov wrote: Hi Gustavo, On 08/18/2017 02:12 AM, Gustavo A. R. Silva wrote: Refactor code in order to avoid identical code for different branches. This issue was detected with the help of Coccinelle. Addresses-Coverity-ID: 1415317 Signed-off

[PATCH] dib0090: fix duplicated code for different branches

2017-08-17 Thread Gustavo A. R. Silva
Refactor code in order to avoid identical code for different branches. This issue was detected with the help of Coccinelle. Addresses-Coverity-ID: 1226795 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- This code was tested by compilation only. drivers/media/dvb-fro

[PATCH] media: venus: fix duplicated code for different branches

2017-08-17 Thread Gustavo A. R. Silva
Refactor code in order to avoid identical code for different branches. This issue was detected with the help of Coccinelle. Addresses-Coverity-ID: 1415317 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- This code was reported by Coverity and it was tested by compilatio

[PATCH] au0828: fix unbalanced lock/unlock in au0828_usb_probe

2017-08-12 Thread Gustavo A. R. Silva
Call mutex_unlock and free dev on failure. Reported-by: Julia Lawall <julia.law...@lip6.fr> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/media/usb/au0828/au0828-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/usb/au0828/au08

Re: [PATCH] ddbridge: constify i2c_algorithm structure

2017-07-16 Thread Gustavo A. R. Silva
Hi Daniel, On 07/10/2017 10:16 AM, Daniel Scheller wrote: Am Sun, 9 Jul 2017 20:15:36 -0500 schrieb "Gustavo A. R. Silva" <garsi...@embeddedor.com>: Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is de

Re: [PATCH] st-delta: constify vb2_ops structures

2017-07-16 Thread Gustavo A. R. Silva
Thank you, Hugues. On 07/07/2017 09:33 AM, Hugues FRUCHET wrote: Acked-by: Hugues Fruchet <hugues.fruc...@st.com> On 07/06/2017 10:14 PM, Gustavo A. R. Silva wrote: Check for vb2_ops structures that are only stored in the ops field of a vb2_queue structure. That field is declared con

Re: [PATCH] stm32-dcmi: constify vb2_ops structure

2017-07-16 Thread Gustavo A. R. Silva
On 07/07/2017 09:33 AM, Hugues FRUCHET wrote: Acked-by: Hugues Fruchet <hugues.fruc...@st.com> Thank you, Hugues. On 07/06/2017 10:05 PM, Gustavo A. R. Silva wrote: Check for vb2_ops structures that are only stored in the ops field of a vb2_queue structure. That field is declared con

[PATCH] ngene: constify i2c_algorithm structure

2017-07-09 Thread Gustavo A. R. Silva
+const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/media/pci/ngene/ngene-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/ngene/ngene-i2c.c b/drivers/media/pci/ngene/ngene-i2c.c

  1   2   >