[PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask()

2021-03-05 Thread Jia-Ju Bai
When bitmap_empty() or feature->feature_num triggers an error, no error return code of smu_v11_0_set_allowed_mask() is assigned. To fix this bug, ret is assigned with -EINVAL as error return code. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/amd/pm/swsmu/sm

[PATCH] gpu: drm: amd: amdgpu: fix error return code of amdgpu_acpi_init()

2021-03-07 Thread Jia-Ju Bai
Add error return code in error hanlding code of amdgpu_acpi_init(). Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu

[PATCH] gpu: drm: i915: fix error return code of igt_buddy_alloc_smoke()

2021-03-08 Thread Jia-Ju Bai
When i915_random_order() returns NULL to order, no error return code of igt_buddy_alloc_smoke() is assigned. To fix this bug, err is assigned with -EINVAL in this case. Fixes: 1fe3818d17c9 ("drm/i915/selftests: try to rein in alloc_smoke") Reported-by: TOTE Robot Signed-off-by:

[PATCH] gpu: drm: i915: fix error return code of igt_threaded_blt()

2021-03-08 Thread Jia-Ju Bai
When kcalloc() returns NULL to tsk or thread, no error code of igt_threaded_blt() is returned. To fix this bug, -ENOMEM is returned as error code. Fixes: 0e99f939f08f ("drm/i915/selftests/blt: add some kthreads into the mix") Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- d

Re: [PATCH] gpu: drm: i915: fix error return code of igt_buddy_alloc_smoke()

2021-03-08 Thread Jia-Ju Bai
On 2021/3/8 17:18, Chris Wilson wrote: Quoting Jia-Ju Bai (2021-03-08 08:59:52) When i915_random_order() returns NULL to order, no error return code of igt_buddy_alloc_smoke() is assigned. To fix this bug, err is assigned with -EINVAL in this case. It would not be EINVAL since that is used

[BUG] gpu: drm: amd: amdgpu: possible ABBA deadlock in amdgpu_set_power_dpm_force_performance_level() and amdgpu_debugfs_process_reg_op()

2021-09-15 Thread Jia-Ju Bai
idx_mutex); --> Line 3697 (Lock A) When amdgpu_debugfs_process_reg_op() and amdgpu_set_power_dpm_force_performance_level() are concurrently executed, the deadlock can occur. I am not quite sure whether this possible deadlock is real and how to fix it if it is real. Any feedback would be appreciated, thanks :) Reported-by: TOTE Robot Best wishes, Jia-Ju Bai

[BUG] gpu: drm: radeon: two possible deadlocks involving locking and waiting

2022-01-31 Thread Jia-Ju Bai
I think this timeout can cause inefficient execution. I am not quite sure whether these possible problems are real and how to fix them if they are real. Any feedback would be appreciated, thanks :) Best wishes, Jia-Ju Bai

[BUG] gpu: drm: possible ABBA deadlock in drm_gem_prime_fd_to_handle() and drm_gem_prime_handle_to_fd()

2021-12-09 Thread Jia-Ju Bai
andle_to_fd() are concurrently executed, the deadlock can occur. I am not quite sure whether this possible deadlock is real and how to fix it if it is real. Any feedback would be appreciated, thanks :) Reported-by: TOTE Robot Best wishes, Jia-Ju Bai

Re: [BUG] gpu: drm: amd: amdgpu: possible ABBA deadlock in amdgpu_set_power_dpm_force_performance_level() and amdgpu_debugfs_process_reg_op()

2021-12-09 Thread Jia-Ju Bai
Hello, Could you please provide the feedback to my previous report? Thanks a lot :) Best wishes, Jia-Ju Bai On 2021/9/15 17:39, Jia-Ju Bai wrote: Hello, My static analysis tool reports a possible ABBA deadlock in the amdgpu driver in Linux 5.10: amdgpu_debugfs_process_reg_op

[PATCH] gpu: drm: qxl: Fix possible null-pointer dereferences in qxl_crtc_atomic_flush()

2019-07-25 Thread Jia-Ju Bai
tatic analysis tool STCheck written by us. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/qxl/qxl_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 8b319ebbb0fb..fae18ef1ba59 100644 --- a/driver

[PATCH] gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_connector_set_property()

2019-07-30 Thread Jia-Ju Bai
may occur. To fix this bug, connector->encoder is checked before being used. This bug is found by a static analysis tool STCheck written by us. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/radeon/radeon_connectors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driv

Re: [BUG] gpu: drm: radeon: two possible deadlocks involving locking and waiting

2022-02-04 Thread Jia-Ju Bai
ode properly. But that happens so rarely and the driver is not developed further that we decided to not address this any more. Ah, okay. Regards, Christian. Am 01.02.22 um 08:40 schrieb Jia-Ju Bai: Hello, My static analysis tool reports a possible deadlock in the radeon driver in Linux

[PATCH] gma500: Fix a sleep-in-atomic bug in psbfb_2d_submit

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is: psbfb_2d_submit (acquire the lock by spin_lock_irqsave) psb_2d_wait_available psb_spank msleep --> may sleep To fix it, the "msleep" is replaced with "mdelay" in psb_spank. Signed-off-by: J

[PATCH] gpu: drm: drm_mm: Fix a sleep-in-atomic-context bug in show_leaks()

2018-09-01 Thread Jia-Ju Bai
with GFP_ATOMIC. This bug is found by my static analysis tool DSAC. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/drm_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 3166026a1874..2486121a78d4 100644 --- a/drivers

Re: [BUG] gpu: drm: amdgpu: Possible sleep-in-atomic-context bugs in amdgpu_uvd_ring_begin_use()

2018-09-17 Thread Jia-Ju Bai
from WREG32() or RREG32()? Best wishes, Jia-Ju Bai On 2018/9/15 17:10, Koenig, Christian wrote: amdgpu_ring_alloc() does call amdgpu_uvd_begin_use(), but never in the call chain you proposed. Thinking about it I actually don't see a way a statically analysis could ever figure that out.

Re: [BUG] gpu: drm: amdgpu: Possible sleep-in-atomic-context bugs in amdgpu_uvd_ring_begin_use()

2018-09-17 Thread Jia-Ju Bai
igure that out. Okay, thanks for your explanation :) Besides, I find that amdgpu_virt_kiq_rreg() calls msleep(), so mdelay() should be used instead. Best wishes, Jia-Ju Bai Am 15.09.2018 11:18 schrieb Jia-Ju Bai : Sorry, I am still not clear why the call chain I proposed is incorrect... I f

Re: [BUG] gpu: drm: amdgpu: Possible sleep-in-atomic-context bugs in amdgpu_uvd_ring_begin_use()

2018-09-17 Thread Jia-Ju Bai
amdgpu_ring_alloc() never calls amdgpu_uvd_ring_begin_use()? Thanks in advance. Best wishes, Jia-Ju Bai Regards, Christian. Am 15.09.2018 10:59 schrieb Jia-Ju Bai : The driver may sleep with holding a spinlock. The function call paths (from bottom to top) in Linux-4.17 are: [FUNC

[BUG] gpu: drm: amdgpu: Possible sleep-in-atomic-context bugs in amdgpu_uvd_ring_begin_use()

2018-09-17 Thread Jia-Ju Bai
: amdgpu_mm_wreg in dce_v6_0_audio_endpt_rreg drivers/gpu/drm/amd/amdgpu/dce_v6_0.c, 125: _raw_spin_lock_irqsave in dce_v6_0_audio_endpt_rreg Note that [FUNC_PTR] means a function pointer call is used. These bugs are found by my static analysis tool DSAC. Best wishes, Jia-Ju Bai

[PATCH] gpu: drm: amdgpu: Replace mdelay with msleep in cik_pcie_gen3_enable()

2018-07-24 Thread Jia-Ju Bai
. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/amd/amdgpu/cik.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c index 0df22030e713..5b7fab2c2008 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm

Re: [BUG] video: fbdev: broadsheetfb: Possible null function pointers

2018-07-27 Thread Jia-Ju Bai
select FB_SYS_FILLRECT select FB_SYS_COPYAREA select FB_SYS_IMAGEBLIT select FB_SYS_FOPS select FB_DEFERRED_IO Do you think it is okay? Best wishes, Jia-Ju Bai ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] video: fbdev: add the dependency of broadsheetfb in Kconfig

2018-07-27 Thread Jia-Ju Bai
broadsheetfb is a platform driver and it should not be used on x86. It should be used only by single ARM PXA board, so adding the dependency in Kconfig. Signed-off-by: Jia-Ju Bai --- drivers/video/fbdev/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video

[PATCH] gpu: drm: radeon: rs600: Replace mdelay() with msleep() and usleep_range() in rs600_asic_reset()

2018-08-06 Thread Jia-Ju Bai
rs600_asic_reset() is never called in atomic context. They call mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep() and usleep_range(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/radeon

[PATCH] gpu: drm: radeon: r300: Replace mdelay() with msleep() and usleep_range() in r300_asic_reset()

2018-08-06 Thread Jia-Ju Bai
r300_asic_reset() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep() and usleep_range(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/radeon

[PATCH] gpu: drm: radeon: r100: Replace mdelay() with msleep() and usleep_range() in r100_asic_reset()

2018-08-06 Thread Jia-Ju Bai
r100_asic_reset() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep() and usleep_range(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/radeon

[PATCH] gpu: drm: radeon: cik: Replace mdelay() with msleep() in cik_pcie_gen3_enable()

2018-08-06 Thread Jia-Ju Bai
cik_pcie_gen3_enable() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/radeon/cik.c | 2 +- 1

[PATCH] gpu: drm: radeon: r600: Replace mdelay() and udelay() with msleep() and usleep_range()

2018-08-06 Thread Jia-Ju Bai
myself. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/radeon/r600.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index e06e2d8feab3..de5f6d9f251e 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b

[PATCH] gpu: drm: radeon: si: Replace mdelay() with msleep() in si_pcie_gen3_enable()

2018-08-06 Thread Jia-Ju Bai
si_pcie_gen3_enable() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). This is found by a static analysis tool named DCNS written by myself Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/radeon/si.c | 2 +- 1

[PATCH] gpu: drm: nouveau: nvkm: nv50: Replace mdelay() with msleep() in nv50_sensor_setup()

2018-08-06 Thread Jia-Ju Bai
nv50_sensor_setup() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/nouveau/nvkm/subdev/therm

[PATCH] gpu: drm: nouveau: nvkm: nv40: Replace mdelay() with msleep() in nv40_sensor_setup()

2018-08-06 Thread Jia-Ju Bai
nv40_sensor_setup() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). This is found by a static analysis tool named DCNS written by myself Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/nouveau/nvkm/subdev/therm

[PATCH] gpu: drm: radeon: radeon_test: Replace mdelay() with msleep()

2018-08-06 Thread Jia-Ju Bai
radeon_test_ring_sync() and radeon_test_ring_sync2() are never called in atomic context. They call mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai

[PATCH] gpu: drm: bridge: adv7511: Replace mdelay with usleep_range in adv7511_probe

2018-04-11 Thread Jia-Ju Bai
sy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

[PATCH] panel-jdi-lt070me05000: Replace mdelay with usleep_range and msleep in jdi_panel_init

2018-04-11 Thread Jia-Ju Bai
DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000

[PATCH 1/2] gpu: drm: ast: Replace mdelay with msleep in reset_mmc_2500

2018-04-11 Thread Jia-Ju Bai
00() calls mdelay() to busily wait. This is not necessary and can be replaced with msleep() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/ast/ast_post.c | 2 +- 1 file c

[PATCH 2/2] gpu: drm: ast: Replace mdelay with msleep in ast_post_chip_2500

2018-04-11 Thread Jia-Ju Bai
g. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/ast/ast_post.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c

[BUG] gma500: Possible sleep-in-atomic bugs in gma_resume_pci

2017-10-08 Thread Jia-Ju Bai
rs/pci/pci.c. These bugs are found by my static analysis tool and my code review. Thanks, Jia-Ju Bai ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] gma500: Fix possible sleep-in-atomic bugs in gma_power_begin

2017-10-10 Thread Jia-Ju Bai
m, the spinlock is released before gma_resume_pci, and it is acquired again after gma_resume_pci. This bug is found by my static analysis tool and my code review. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/gma500/power.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/

[PATCH] pci: Fix a possible sleep-in-atomic bug in pci_set_power_state

2017-10-10 Thread Jia-Ju Bai
bugs are found by my static analysis tool and my code review. Signed-off-by: Jia-Ju Bai --- drivers/pci/pci.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6078dfc..7b763a3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c

Re: [PATCH] pci: Fix a possible sleep-in-atomic bug in pci_set_power_state

2017-10-10 Thread Jia-Ju Bai
Oh, sorry, I will send the patches for each driver. Thanks, Jia-Ju Bai On 2017/10/9 16:17, Greg KH wrote: On Mon, Oct 09, 2017 at 04:16:20PM +0800, Jia-Ju Bai wrote: The drivers vt6655 and gma500 call pci_set_power_state under a spinlock, which may sleep. The function call paths are

[PATCH] drm: Fix a possible sleep-in-atomic bug in show_leaks

2017-12-14 Thread Jia-Ju Bai
SAC) and checked by my code review. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/drm_mm.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 61a1c8e..5b9965d 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/