Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1467243

[PATCH 1/1] drm/radeon: avoid NULL dereference, si_get_vce_clock_voltage

From Heinrich Schuchardt <xypron.glpk@gmx.de>
Newsgroups linux.kernel
Subject [PATCH 1/1] drm/radeon: avoid NULL dereference, si_get_vce_clock_voltage
Date 2016-08-21 23:00 +0200
Message-ID <s8I0x-5f3-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


It does not make sense to check if table is NULL
and afterwards to dereference it without
considering the result.

The inconsistency was indicated by cppcheck.
An actual NULL pointer dereference was not observed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/gpu/drm/radeon/si_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index e6abc09..ba2cf12 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2962,7 +2962,7 @@ static int si_get_vce_clock_voltage(struct radeon_device *rdev,
 		&rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table;
 
 	if (((evclk == 0) && (ecclk == 0)) ||
-	    (table && (table->count == 0))) {
+	    table == NULL || table->count == 0) {
 		*voltage = 0;
 		return 0;
 	}
-- 
2.1.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] drm/radeon: avoid NULL dereference, si_get_vce_clock_voltage Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-08-21 23:00 +0200
  Re: [PATCH 1/1] drm/radeon: avoid NULL dereference,  si_get_vce_clock_voltage Joe Perches <joe@perches.com> - 2016-08-21 23:10 +0200
    Re: [PATCH 1/1] drm/radeon: avoid NULL dereference,  si_get_vce_clock_voltage Heinrich Schuchardt <xypron.debian@gmx.de> - 2016-08-21 23:30 +0200
      Re: [PATCH 1/1] drm/radeon: avoid NULL dereference,  si_get_vce_clock_voltage Joe Perches <joe@perches.com> - 2016-08-21 23:40 +0200

csiph-web