[PATCH] drm/amdgpu/pm: Fix potential Spectre v1

2018-07-24 Thread Gustavo A. R. Silva
Cc: sta...@vger.kernel.org Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 15a1192..a446c7c 100644

Re: [PATCH v2] drm/amd/display/dc/dce: Fix multiple potential integer overflows

2018-07-20 Thread Gustavo A. R. Silva
Hi Alex, Harry, I wonder if this patch should have been tagged for stable. Thanks -- Gustavo On 07/04/2018 08:22 AM, Gustavo A. R. Silva wrote: > Add suffix ULL to constant 5 and cast variables target_pix_clk_khz and > feedback_divider to uint64_t in order to avoid multiple potential i

Re: [PATCH v2] drm/pl111: Use 64-bit arithmetic instead of 32-bit

2018-07-18 Thread Gustavo A. R. Silva
Hi Eric, On 07/17/2018 01:40 PM, Eric Anholt wrote: > "Gustavo A. R. Silva" writes: > >> Add suffix ULL to constant 1000 in order to give the compiler complete >> information about the proper arithmetic to use. >> >> Notice that such constant is used in

[PATCH] drm/i915/selftests: Remove redundant code

2018-07-17 Thread Gustavo A. R. Silva
err is assigned to -EIO, but this value is never actually used and *err* is updated later on. Remove such reduntant code. Addresses-Coverity-ID: 1471816 ("Unused value") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/i915/selftests/intel_guc.c | 1 - 1 file changed, 1 deletio

[PATCH] drm/ttm: use swap macro in ttm_bo_handle_move_mem

2018-07-10 Thread Gustavo A. R. Silva
Make use of the swap macro and remove unnecessary variable *tmp_mem*. This makes the code easier to read and maintain. Also, reduces the stack usage. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/ttm/ttm_bo.c | 7 ++- 1 file

[PATCH] omapfb: Mark expected switch fall-throughs

2018-07-10 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva --- drivers/video/fbdev/omap2/omapfb/dss/dispc.c | 2 ++ drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 1 + 2 files changed, 3 insertions(+) diff

[PATCH] backlight: adp8860: Mark expected switch fall-through

2018-07-10 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva --- drivers/video/backlight/adp8860_bl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video

[PATCH] video: fbdev: mark expected switch fall-throughs

2018-07-10 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva --- drivers/video/fbdev/i740fb.c | 1 + drivers/video/fbdev/pm2fb.c | 2 ++ drivers/video/fbdev/tdfxfb.c | 1 + drivers/video/fbdev/via/lcd.c | 1

[PATCH] fbdev: fbmem: mark expected switch fall-through

2018-07-10 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva --- drivers/video/fbdev/core/fbmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core

Re: [PATCH] drm/i915: Mark expected switch fall-throughs

2018-07-06 Thread Gustavo A. R. Silva
On 07/05/2018 08:43 AM, Jani Nikula wrote: > On Fri, 29 Jun 2018, Jani Nikula wrote: >> On Thu, 28 Jun 2018, "Gustavo A. R. Silva" wrote: >>> In preparation to enabling -Wimplicit-fallthrough, mark switch cases >>> where we are expecting to fall through.

Re: [PATCH] drm/amd/display/dc/dce: Fix multiple potential integer overflows

2018-07-05 Thread Gustavo A. R. Silva
Hi Michel, On 07/04/2018 02:38 AM, Michel Dänzer wrote: > On 2018-07-04 03:13 AM, Gustavo A. R. Silva wrote: >> Add suffix ULL to constant 5 and cast variables target_pix_clk_khz and >> feedback_divider to uint64_t in order to avoid multiple potential integer >> overflows

[PATCH v2] drm/pl111: Use 64-bit arithmetic instead of 32-bit

2018-07-05 Thread Gustavo A. R. Silva
arithmetic: mode->clock * 1000 Addresses-Coverity-ID: 1466139 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Use suffix ULL instead of UL. drivers/gpu/drm/pl111/pl111_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-

Re: [PATCH] drm/amd/display/dc/dce: Fix multiple potential integer overflows

2018-07-05 Thread Gustavo A. R. Silva
On 07/04/2018 12:51 PM, Harry Wentland wrote: [..] >>> >>> @@ -145,8 +145,8 @@ static bool calculate_fb_and_fractional_fb_divider( >>> * of fractional feedback decimal point and the fractional FB Divider >>> precision >>> * is 2 then the equation becomes (ullfeedbackDivider + 5*100) /

[PATCH v2] drm/amd/display/dc/dce: Fix multiple potential integer overflows

2018-07-05 Thread Gustavo A. R. Silva
ot;) Fixes: 4562236b3bc0 ("drm/amd/dc: Add dc display driver (v2)") Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Add suffix ULL to constant 5 instead of UL. Thanks to Michel Dänzer for pointing this out. drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 10 +-

Re: [PATCH] drm/pl111: Use 64-bit arithmetic instead of 32-bit

2018-07-05 Thread Gustavo A. R. Silva
Hi, Please, ignore this. I should have used ULL instead of UL. I'll send v2 shortly. Thanks -- Gustavo On 07/03/2018 06:51 PM, Gustavo A. R. Silva wrote: > Add suffix UL to constant 1000 in order to give the compiler complete > information about the proper arithmetic to use. >

[PATCH] drm/pl111: Use 64-bit arithmetic instead of 32-bit

2018-07-04 Thread Gustavo A. R. Silva
arithmetic: mode->clock * 1000 Addresses-Coverity-ID: 1466139 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/pl111/pl111_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/dr

[PATCH] drm/amd/display/dc/dce: Fix multiple potential integer overflows

2018-07-04 Thread Gustavo A. R. Silva
ot;) Fixes: 4562236b3bc0 ("drm/amd/dc: Add dc display driver (v2)") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_so

[PATCH] drm/via: mark expected switch fall-throughs

2018-07-03 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/via/via_dmablit.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via

[PATCH] drm/i915: Mark expected switch fall-throughs

2018-06-29 Thread Gustavo A. R. Silva
Addresses-Coverity-ID: 1357403 Addresses-Coverity-ID: 1357433 Addresses-Coverity-ID: 1392622 Addresses-Coverity-ID: 1415273 Addresses-Coverity-ID: 1435752 Addresses-Coverity-ID: 1441500 Addresses-Coverity-ID: 1454596 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/i915/i915_gem.c | 1

Re: [Intel-gfx] [PATCH] drm/i915: mark expected switch fall-through

2018-06-29 Thread Gustavo A. R. Silva
> > Right. That's because we've used MISSING_CASE() also in if-ladders in > addition to the switch default case. From our POV the usage is similar. > Yep. > *shrug* > > I guess I like /* fall through */ annotations next to MISSING_CASE() > better than having two different macros depending on

Re: [PATCH] drm/gma500: Fix compile warning

2018-06-27 Thread Gustavo A. R. Silva
On 06/26/2018 08:28 AM, Ville Syrjälä wrote: > On Mon, Jun 25, 2018 at 07:33:55AM -0500, Gustavo A. R. Silva wrote: >> Fix the following compile warning: >> >> warning: unused variable ‘psbfb’ [-Wunused-variable] >> struct psb_framebuffer *psbfb = to_psb_fb(fb); >

Re: [Intel-gfx] [PATCH] drm/i915: mark expected switch fall-through

2018-06-27 Thread Gustavo A. R. Silva
Hi Jani, On 06/21/2018 03:03 AM, Jani Nikula wrote: > On Wed, 20 Jun 2018, "Gustavo A. R. Silva" wrote: >> On 06/20/2018 02:06 PM, Rodrigo Vivi wrote: >>> On Wed, Jun 20, 2018 at 08:31:00AM -0500, Gustavo A. R. Silva wrote: >>>> In preparation to enab

[PATCH] drm/nouveau/nvkm: mark expected switch fall-throughs

2018-06-27 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi.c| 17 + drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv04.c | 1 + drivers/gpu

[PATCH] drm/gma500: Fix compile warning

2018-06-26 Thread Gustavo A. R. Silva
Fix the following compile warning: warning: unused variable ‘psbfb’ [-Wunused-variable] struct psb_framebuffer *psbfb = to_psb_fb(fb); Fixes: c7cbed560ce2 ("drm/gma500: Fix Medfield for drm_framebuffer move") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/gma500/mdfld_intel

[PATCH] drm/gma500: Fix potential NULL pointer dereference

2018-06-26 Thread Gustavo A. R. Silva
y: Gustavo A. R. Silva --- drivers/gpu/drm/gma500/gma_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c index c8f071c..f767579 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drive

Re: [Intel-gfx] [PATCH] drm/i915: mark expected switch fall-through

2018-06-21 Thread Gustavo A. R. Silva
On 06/20/2018 02:06 PM, Rodrigo Vivi wrote: On Wed, Jun 20, 2018 at 08:31:00AM -0500, Gustavo A. R. Silva wrote: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1470102 ("Missing break in switch")

[PATCH] drm/i915: mark expected switch fall-through

2018-06-21 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1470102 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/i915/intel_dpll_mgr.c | 1 + 1 file changed, 1 insertion(+)

[PATCH] drm/amd/display: fix type of variable

2018-06-16 Thread Gustavo A. R. Silva
t result") Fixes: 2b6199a1d1b7 ("drm/amd/display: replace msleep with udelay in fbc path") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/dr

Re: [PATCH] drm/i915/selftests: Fix uninitialized variable

2018-04-25 Thread Gustavo A. R. Silva
On 04/24/2018 08:22 AM, Chris Wilson wrote: Quoting Gustavo A. R. Silva (2018-04-24 14:15:45) There is a potential execution path in which variable err is returned without being properly initialized previously. Fix this by initializing variable err to 0. err is only returned along an error

[PATCH] drm/i915/selftests: Fix uninitialized variable

2018-04-25 Thread Gustavo A. R. Silva
egisters across resets") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/drm/i915/selftests/intel_workarounds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/selftests/intel_workarounds.c b/drivers/gpu/drm/i915/selftests

[PATCH] drm/i915/gvt/scheduler: Remove unnecessary NULL checks in sr_oa_regs

2018-03-22 Thread Gustavo A. R. Silva
The checks are misleading and not required [1]. [1] https://lkml.org/lkml/2018/3/19/1792 Addresses-Coverity-ID: 1466017 Cc: Chris Wilson <ch...@chris-wilson.co.uk> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/drm/i915/gvt/scheduler.c | 2 +- 1 fil

Re: [PATCH] drm/i915/gvt/scheduler: fix potential NULL pointer dereference

2018-03-22 Thread Gustavo A. R. Silva
Hi Chris, On 03/19/2018 03:38 PM, Chris Wilson wrote: Quoting Gustavo A. R. Silva (2018-03-19 19:30:53) _workload_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after _workload_ has been null

[PATCH] video: fbdev: aty128fb: use true and false for boolean values

2018-03-22 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/video/fbdev/aty/aty128fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] drm/i915/gvt/scheduler: fix potential NULL pointer dereference

2018-03-22 Thread Gustavo A. R. Silva
ot;drm/i915/gvt: keep oa config in shadow ctx") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/drm/i915/gvt/scheduler.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/

[PATCH] drm/i915/gvt: Mark expected switch fall-through in handle_g2v_notification

2018-03-22 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1466154 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/drm/i915/gvt/handlers.c | 1 + 1

Re: [PATCH] drm/i915/gvt/scheduler: fix potential NULL pointer dereference

2018-03-22 Thread Gustavo A. R. Silva
On 03/19/2018 04:23 PM, Chris Wilson wrote: Quoting Gustavo A. R. Silva (2018-03-19 20:50:12) Hi Chris, On 03/19/2018 03:38 PM, Chris Wilson wrote: Quoting Gustavo A. R. Silva (2018-03-19 19:30:53) _workload_ is being dereferenced before it is null checked, hence there is a potential null

[PATCH] drm/nouveau/secboot: remove VLA usage

2018-03-14 Thread Gustavo A. R. Silva
the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/s

[PATCH v2] drm/nouveau/secboot: remove VLA usage

2018-03-14 Thread Gustavo A. R. Silva
the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Use sizeof(buf) instead of NVKM_MSGQUEUE_CMDLINE_SIZE. This change is based on the feedback provided by David Laight. Thanks David. drivers/gpu/drm/nouveau/nvkm/

Re: [PATCH] drm/nouveau/secboot: remove VLA usage

2018-03-14 Thread Gustavo A. R. Silva
Hi David, On 03/13/2018 11:10 AM, David Laight wrote: From: Gustavo A. R. Silva Sent: 13 March 2018 14:48 In preparation to enabling -Wvla, remove VLA. In this particular case directly use macro NVKM_MSGQUEUE_CMDLINE_SIZE instead of local variable cmdline_size. Also, remove cmdline_size

[PATCH] drm/vc4_validate: Remove VLA usage

2018-03-14 Thread Gustavo A. R. Silva
-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/drm/vc4/vc4_validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c index 2db485a..eec76af 100644 --- a/drivers/gpu/drm/vc4/vc4_validate.c

Re: [PATCH] video: fbdev: via: remove VLA usage

2018-03-13 Thread Gustavo A. R. Silva
On 03/09/2018 05:02 AM, Emil Velikov wrote: On 9 March 2018 at 10:59, Eric Engestrom <eric.engest...@imgtec.com> wrote: On Thursday, 2018-03-08 11:39:49 -0600, Gustavo A. R. Silva wrote: In preparation to enabling -Wvla, remove VLA usage. Also, fixed as part of the directive to remo

Re: [PATCH] video: fbdev: via_aux_vt1632: remove VLA usage

2018-03-09 Thread Gustavo A. R. Silva
Hi Emil, On 03/08/2018 05:58 AM, Emil Velikov wrote: Hi Gustavo, On 7 March 2018 at 19:54, Gustavo A. R. Silva <gust...@embeddedor.com> wrote: In preparation to enabling -Wvla, remove VLA and replace it with a fixed-length array instead. Also, remove variable 'len'. What is the

[PATCH] video: fbdev: via: remove VLA usage

2018-03-09 Thread Gustavo A. R. Silva
In preparation to enabling -Wvla, remove VLA usage. Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/video/fbdev/via/via_aux_sii164.c | 2 +- drivers/video

[PATCH] video: fbdev: via_aux_vt1632: remove VLA usage

2018-03-07 Thread Gustavo A. R. Silva
In preparation to enabling -Wvla, remove VLA and replace it with a fixed-length array instead. Also, remove variable 'len'. Notice that no new IDs have been added in seven years. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/video/fbdev/via/via_aux_vt1632

[PATCH] video: fbdev: via_aux_vt1636: remove VLA usage

2018-03-07 Thread Gustavo A. R. Silva
In preparation to enabling -Wvla, remove VLA and replace it with a fixed-length array instead. Also, remove variable 'len'. Notice that no new IDs have been added in seven years. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/video/fbdev/via/via_aux_vt1636

Re: [PATCH] drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry

2018-02-15 Thread Gustavo A. R. Silva
Hi Oded, On 02/15/2018 04:08 AM, Oded Gabbay wrote: Hi Gustavo, The patch is queued for the merge window of kernel 4.17 (opens in about 7 weeks from now). Awesome. Thanks for the info. -- Gustavo Oded On Wed, Feb 14, 2018 at 11:30 PM, Gustavo A. R. Silva <garsi...@embeddedor.com>

Re: [PATCH] drm/i915/selftests: fix inconsistent IS_ERR and PTR_ERR

2018-02-15 Thread Gustavo A. R. Silva
On 02/15/2018 03:13 AM, Jani Nikula wrote: On Wed, 14 Feb 2018, "Gustavo A. R. Silva" <gust...@embeddedor.com> wrote: Fix inconsistent IS_ERR and PTR_ERR in shrink_boom. The proper pointer to use is _explode_ instead of _purge_. This issue was detected with the help of Co

Re: [PATCH] drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm

2018-02-15 Thread Gustavo A. R. Silva
On 02/15/2018 06:32 AM, Christian König wrote: Am 15.02.2018 um 06:20 schrieb Gustavo A. R. Silva: Currently, if amdgpu_vm_bo_update() fails, the returned error is being ignored. Fix this by properly checking _r_ after calling amdgpu_vm_bo_update. Also, remove redundant code just before

[PATCH] drm/i915/selftests: fix inconsistent IS_ERR and PTR_ERR

2018-02-15 Thread Gustavo A. R. Silva
Fix inconsistent IS_ERR and PTR_ERR in shrink_boom. The proper pointer to use is _explode_ instead of _purge_. This issue was detected with the help of Coccinelle. Fixes: fe215c8bc426 ("drm/i915/selftests: add missing gtt shrinker test") Signed-off-by: Gustavo A. R. Silva <gust...@e

[PATCH] drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm

2018-02-15 Thread Gustavo A. R. Silva
dgpu: update VM PDs after the PTs") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/

Re: [PATCH] drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry

2018-02-15 Thread Gustavo A. R. Silva
Hi all, I was just wondering about the status of this patch. Thanks -- Gustavo On 01/19/2018 04:18 PM, Felix Kuehling wrote: Looks good. This change is Reviewed-by: Felix Kuehling <felix.kuehl...@amd.com> Regards,   Felix On 2018-01-18 07:39 PM, Gustavo A. R. Silva wrote: Use ARRA

[drm-nouveau-mmu] question about potential NULL pointer dereference

2018-02-14 Thread Gustavo A. R. Silva
Hi all, While doing some static analysis I ran into the following piece of code at drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:957: 957#define node(root, dir) ((root)->head.dir == >list) ? NULL : \ 958list_entry((root)->head.dir, struct nvkm_vma, head) 959

Re: [drm-nouveau-mmu] question about potential NULL pointer dereference

2018-02-14 Thread Gustavo A. R. Silva
Quoting Ben Skeggs <bske...@redhat.com>: On Wed, Feb 14, 2018 at 1:40 AM, Gustavo A. R. Silva <garsi...@embeddedor.com> wrote: Hi all, While doing some static analysis I ran into the following piece of code at drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:957: 957#define no

[PATCH] video: fbdev: vermilion: use 64-bit arithmetic instead of 32-bit

2018-02-06 Thread Gustavo A. R. Silva
f-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/video/fbdev/vermilion/vermilion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c index 6f8d444..5172fa5 100644 --- a/

Re: [PATCH] drm/msm/adreno/a5xx_debugfs: fix potential NULL pointer dereference

2018-02-04 Thread Gustavo A. R. Silva
Quoting Rob Clark <robdcl...@gmail.com>: On Fri, Feb 2, 2018 at 11:30 AM, Jordan Crouse <jcro...@codeaurora.org> wrote: On Fri, Feb 02, 2018 at 06:32:23AM -0600, Gustavo A. R. Silva wrote: _minor_ is being dereferenced before it is null checked, hence there is a potential

[PATCH] drm/msm/adreno/a5xx_debugfs: fix potential NULL pointer dereference

2018-02-02 Thread Gustavo A. R. Silva
_minor_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after _minor_ has been null checked. Fixes: 024ad8df763f ("drm/msm: add a5xx specific debugfs") Signed-off-by: Gustavo A. R. Si

[PATCH] drm/msm/dsi: Fix potential NULL pointer dereference in msm_dsi_modeset_init

2018-02-02 Thread Gustavo A. R. Silva
_dev_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after _dev_ has been null checked. Fixes: d4e7f38d70ef ("drm/msm/dsi: check msm_dsi and dsi pointers before use") Signed-off-by: Gu

Re: [PATCH] drm/edid: use false for boolean value

2018-01-31 Thread Gustavo A. R. Silva
Hi Daniel, Quoting Daniel Vetter <dan...@ffwll.ch>: On Tue, Jan 23, 2018 at 10:46:07AM -0600, Gustavo A. R. Silva wrote: 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

[PATCH v2] drm/edid: use true and false for boolean values

2018-01-31 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> --- Changes in v2: - Use true for boolean value in add_detailed_mode as suggested by Daniel

Re: [PATCH] drm/etnaviv: fix '%x' warning

2018-01-24 Thread Gustavo A. R. Silva
Hello Lucas, Quoting Lucas Stach <l.st...@pengutronix.de>: Hi Gustavo, Am Dienstag, den 23.01.2018, 11:07 -0600 schrieb Gustavo A. R. Silva: Fix the following warning by using %zx instead of %x for variable of type size_t: warning: format ‘%x’ expects argument of type ‘unsign

[PATCH] drm/edid: use false for boolean value

2018-01-24 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/gpu/drm/drm_edid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drive

[PATCH] drm/etnaviv: fix '%x' warning

2018-01-24 Thread Gustavo A. R. Silva
tions") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- This code was compiled with GCC 7.2.0 drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etn

Re: [PATCH] drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry

2018-01-21 Thread Gustavo A. R. Silva
Quoting Felix Kuehling : Looks good. This change is Reviewed-by: Felix Kuehling Thanks Felix. -- Gustavo ___ dri-devel mailing list dri-devel@lists.freedesktop.org

[PATCH] drm/vmwgfx: Return boolean instead of integer in vmw_fence_obj_signaled

2018-01-19 Thread Gustavo A. R. Silva
Return statements in functions returning bool should use true/false instead of 1/0. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 de

[PATCH] drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry

2018-01-19 Thread Gustavo A. R. Silva
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH v2] drm/amdkfd: Fix potential NULL pointer dereferences

2018-01-12 Thread Gustavo A. R. Silva
Quoting Oded Gabbay <oded.gab...@gmail.com>: On Thu, Jan 11, 2018 at 1:15 AM, Gustavo A. R. Silva <garsi...@embeddedor.com> wrote: In case kfd_get_process_device_data returns null, there are some null pointer dereferences in functions kfd_bind_process

[PATCH v2] drm/amdkfd: Fix potential NULL pointer dereferences

2018-01-11 Thread Gustavo A. R. Silva
: 1463794 ("Dereference null return value") Addresses-Coverity-ID: 1463772 ("Dereference null return value") Suggested-by: Felix Kuehling <felix.kuehl...@amd.com> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: Print a WARN_ON and ski

Re: [PATCH] drm/amdkfd: Fix potential NULL pointer dereferences

2018-01-11 Thread Gustavo A. R. Silva
mutex_unlock(>mutex); + continue; + } + if (pdd->bound == PDD_BOUND) pdd->bound = PDD_BOUND_SUSPENDED; mutex_unlock(>mutex); Thank you for the feedback. -- Gustavo Regards,   Felix On 2018-01

[PATCH] drm/amdkfd: Fix potential NULL pointer dereferences

2018-01-10 Thread Gustavo A. R. Silva
value") Addresses-Coverity-ID: 1463772 ("Dereference null return value") Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_proces

Re: [PATCH] drm/i915/gvt/fb_decoder: Fix out-of-bounds read

2017-12-13 Thread Gustavo A. R. Silva
Hi Zhenyu, Quoting Zhenyu Wang <zhen...@linux.intel.com>: On 2017.12.09 00:37:59 -0600, Gustavo A. R. Silva wrote: In case function skl_format_to_drm returns -EINVAL, fmt turns into a huge number as fmt is of type u32, hence there is an out-of-bounds read when using fmt as an index for

[PATCH] drm/i915/gvt/fb_decoder: Fix out-of-bounds read

2017-12-11 Thread Gustavo A. R. Silva
") Fixes: 9f31d1063b43 ("drm/i915/gvt: Add framebuffer decoder support") Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/i915/gvt/fb_decoder.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.

Re: [PATCH] drm/fb-helper: Fix potential NULL pointer dereference

2017-12-07 Thread Gustavo A. R. Silva
Quoting Daniel Vetter <dan...@ffwll.ch>: On Tue, Dec 05, 2017 at 11:46:28AM -0600, Gustavo A. R. Silva wrote: fb_helper is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after fb_helper ha

[PATCH] drm/fb-helper: Fix potential NULL pointer dereference

2017-12-06 Thread Gustavo A. R. Silva
andle function NULL argument") Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/drm_fb_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 6654f2f..04a3a5c 1006

Re: [PATCH] drm/vmwgfx_kms: Fix potential NULL pointer dereference

2017-12-06 Thread Gustavo A. R. Silva
Hi Ville, Quoting Ville Syrjälä <ville.syrj...@linux.intel.com>: On Mon, Dec 04, 2017 at 03:54:18PM -0600, Gustavo A. R. Silva wrote: crtc_state is being null checked in a previous code block, which implies that such pointer might be null. crtc_state is derefe

Re: [PATCH] drm/i915: Mark expected switch fall-throughs

2017-12-05 Thread Gustavo A. R. Silva
Hi Joonas, Quoting Joonas Lahtinen <joonas.lahti...@linux.intel.com>: On Mon, 2017-11-27 at 16:17 -0600, Gustavo A. R. Silva wrote: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. I have to say I'm totally not sold on r

[PATCH] drm/vmwgfx_kms: Fix potential NULL pointer dereference

2017-12-05 Thread Gustavo A. R. Silva
is null. Addresses-Coverity-ID: 1462412 ("Dereference after null check") Fixes: a01cb8ba3f62 ("drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c") Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +++ 1

[PATCH] drm/i915: Mark expected switch fall-throughs

2017-11-28 Thread Gustavo A. R. Silva
Addresses-Coverity-ID: 1357403 Addresses-Coverity-ID: 1357433 Addresses-Coverity-ID: 1392622 Addresses-Coverity-ID: 1415273 Addresses-Coverity-ID: 1435752 Addresses-Coverity-ID: 1441500 Addresses-Coverity-ID: 1454596 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/dr

[PATCH] drm/amd/display: Fix potential NULL pointer dereferences in amdgpu_dm_atomic_commit_tail

2017-11-27 Thread Gustavo A. R. Silva
ll check") Addresses-Coverity-ID: 1423833 ("Dereference before null check") Fixes: e7b07ceef2a6 ("drm/amd/display: Merge amdgpu_dm_types and amdgpu_dm") Fixes: 54d765752467 ("drm/amd/display: Unify amdgpu_dm state variable namings.") Signed-off-by: Gustavo A. R. Silva <

Re: [PATCH] drm/amd/display/dc/dce110/dce110_mem_input_v: use swap macro in program_size_and_rotation

2017-11-20 Thread Gustavo A. R. Silva
Quoting Harry Wentland <harry.wentl...@amd.com>: On 2017-11-10 05:31 PM, Gustavo A. R. Silva wrote: Make use of the swap macro instead of _manually_ swapping values and remove unnecessary variable swap. This makes the code easier to read and maintain. This code was detected with th

[PATCH] drm/amd/display/dc/core/dc_resource: use swap macro in rect_swap_helper

2017-11-13 Thread Gustavo A. R. Silva
Make use of the swap macro instead of _manually_ swapping values and remove unnecessary variable temp. 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/gpu/d

[PATCH] drm/amd/display/dc/dce110/dce110_mem_input_v: use swap macro in program_size_and_rotation

2017-11-13 Thread Gustavo A. R. Silva
Make use of the swap macro instead of _manually_ swapping values and remove unnecessary variable swap. 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> --- .../drm/amd/disp

[PATCH] video: fbdev: sis_main: mark expected switch fall-throughs

2017-11-09 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 115025 Addresses-Coverity-ID: 115026 Addresses-Coverity-ID: 115027 Addresses-Coverity-ID: 115028 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.

[PATCH] drm/i915/intel_sdvo: mark expected switch fall-throughs

2017-11-09 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 141432 Addresses-Coverity-ID: 141433 Addresses-Coverity-ID: 141434 Addresses-Coverity-ID: 141435 Addresses-Coverity-ID: 141436 Signed-off-by: Gustavo A. R. Silva

[PATCH] video: fbdev: sm501fb: mark expected switch fall-through in sm501fb_blank_crt

2017-11-07 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/video/fbdev/sm501fb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/sm501fb.c b/d

[PATCH] video: fbdev: aty: radeon_pm: mark expected switch fall-throughs

2017-11-07 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/video/fbdev/aty/radeon_pm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/fbd

[PATCH] video: fbdev: cirrusfb: mark expected switch fall-throughs

2017-11-07 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Notice that in this particular case I placed the "fall through" comment on its own line, which is what GCC is expecting to find. Signed-off-by: Gustavo A. R. Si

[PATCH] drm/nouveau/devinit/nv04: mark expected switch fall-throughs

2017-11-03 Thread Gustavo A. R. Silva
-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv04.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv04.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv04.c

[PATCH] drm/via/via_dmablit: mark expected switch fall-throughs

2017-11-03 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 114740 Addresses-Coverity-ID: 114741 Addresses-Coverity-ID: 114742 Addresses-Coverity-ID: 114743 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.

[PATCH] drm/nouveau/bios/timing: mark expected switch fall-throughs

2017-11-03 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1260018 Addresses-Coverity-ID: 1260019 Addresses-Coverity-ID: 1260022 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/nouvea

[PATCH] drm/savage/savage_state: mark expected switch fall-throughs

2017-11-03 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 114735 Addresses-Coverity-ID: 114736 Addresses-Coverity-ID: 114737 Addresses-Coverity-ID: 114738 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.

[PATCH] drm/gma500: fix potential NULL pointer dereference dereference

2017-08-12 Thread Gustavo A. R. Silva
A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c index 1616af2..c50534c 100644 --- a/drive

[PATCH] gpu: host1x: fix error return code in host1x_probe()

2017-08-08 Thread Gustavo A. R. Silva
/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af Print and propagate the return value of platform_get_irq on failure. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/gpu/host1x/dev.c | 4 ++--

Re: [PATCH] drm/tegra: vic: add NULL check on of_match_device() return value

2017-07-10 Thread Gustavo A. R. Silva
Hi Thierry, Quoting Thierry Reding <thierry.red...@gmail.com>: On Fri, Jul 07, 2017 at 01:16:26AM -0500, Gustavo A. R. Silva wrote: Check return value from call to of_match_device() in order to prevent a NULL pointer dereference. In case of NULL print error message and return. Sign

[PATCH] drm: bridge: dw-hdmi: constify snd_pcm_ops structure

2017-07-07 Thread Gustavo A. R. Silva
, e2; position p; @@ snd_pcm_set_ops(e1, e2, @p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; Signed-off-by: Gustavo A. R. Silva <ga

[PATCH] drm/tegra: vic: add NULL check on of_match_device() return value

2017-07-07 Thread Gustavo A. R. Silva
Check return value from call to of_match_device() in order to prevent a NULL pointer dereference. In case of NULL print error message and return. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/tegra/vic.c | 5 + 1 file changed, 5 insertions(+) diff

[PATCH] drm/tegra: sor: add NULL check on of_match_device() return value

2017-07-07 Thread Gustavo A. R. Silva
Check return value from call to of_match_device() in order to prevent a NULL pointer dereference. In case of NULL print error message and return. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/tegra/sor.c | 4 1 file changed, 4 insertions(+) diff

[PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value

2017-07-06 Thread Gustavo A. R. Silva
The right variable to check here is port, not dp. This issue was detected using Coccinelle and the following semantic patch: @@ expression x; identifier fld; @@ * x = devm_kzalloc(...); ... when != x == NULL x->fld Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> ---

Re: [PATCH] drm/radeon: add header comment for clarification to vce_v2_0_enable_mgcg()

2017-06-29 Thread Gustavo A. R. Silva
Quoting Alex Deucher <alexdeuc...@gmail.com>: On Thu, Jun 29, 2017 at 1:38 PM, Gustavo A. R. Silva <garsi...@embeddedor.com> wrote: Add function header comment to make it clear that local variable sw_cg is used for debugging and it should not be removed. Addresses-Coverity-ID

[PATCH] drm/radeon: add header comment for clarification to vce_v2_0_enable_mgcg()

2017-06-29 Thread Gustavo A. R. Silva
Add function header comment to make it clear that local variable sw_cg is used for debugging and it should not be removed. Addresses-Coverity-ID: 1198635 Cc: Alex Deucher <alexdeuc...@gmail.com> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/gpu/drm/radeo

[gpu-drm-radeon] question about potential dead code in vce_v2_0_enable_mgcg()

2017-06-28 Thread Gustavo A. R. Silva
to be logically dead. My question here is if such variable is there for testing purposes or if it is a sort of an old code leftover that should be removed? In any case I can send a patch to add a comment or remove the dead code. I'd really appreciate any comments on this. Thank you! -- Gust

<    1   2   3   4   5   >