[next] drm/i915: fix uninitialized variable 'subslice_mask'

Submitted by Colin King on May 29, 2019, 2:43 p.m.

Details

Message ID 20190529144325.17235-1-colin.king@canonical.com
State New
Headers show
Series "drm/i915: fix uninitialized variable 'subslice_mask'" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Colin King May 29, 2019, 2:43 p.m.
From: Colin Ian King <colin.king@canonical.com>

Currently subslice_mask is not initialized and so data is being
bit-wise or'd into a garbage value. Fix this by inintializing
subslice_mask to zero.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 1ac159e23c2c ("drm/i915: Expand subslice mask")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/i915/intel_device_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
index 3625f777f3a3..d395a09b994f 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -298,7 +298,7 @@  static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv)
 {
 	struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu;
 	u32 fuse;
-	u8 subslice_mask;
+	u8 subslice_mask = 0;
 
 	fuse = I915_READ(CHV_FUSE_GT);
 

Comments

On 29/05/2019 16:04, Jani Nikula wrote:
> On Wed, 29 May 2019, Colin King <colin.king@canonical.com> wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently subslice_mask is not initialized and so data is being
>> bit-wise or'd into a garbage value. Fix this by inintializing
>> subslice_mask to zero.
>>
>> Addresses-Coverity: ("Uninitialized scalar variable")
>> Fixes: 1ac159e23c2c ("drm/i915: Expand subslice mask")
> 
> This was already reverted for other reasons. Need to be fixed on the
> next round. For future reference, please Cc: author and reviewers of the
> referenced commit.

OK, will do.

Thanks, Colin
> 
> BR,
> Jani.
> 
> 
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/gpu/drm/i915/intel_device_info.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
>> index 3625f777f3a3..d395a09b994f 100644
>> --- a/drivers/gpu/drm/i915/intel_device_info.c
>> +++ b/drivers/gpu/drm/i915/intel_device_info.c
>> @@ -298,7 +298,7 @@ static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv)
>>  {
>>  	struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu;
>>  	u32 fuse;
>> -	u8 subslice_mask;
>> +	u8 subslice_mask = 0;
>>  
>>  	fuse = I915_READ(CHV_FUSE_GT);
>
On Wed, 29 May 2019, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently subslice_mask is not initialized and so data is being
> bit-wise or'd into a garbage value. Fix this by inintializing
> subslice_mask to zero.
>
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: 1ac159e23c2c ("drm/i915: Expand subslice mask")

This was already reverted for other reasons. Need to be fixed on the
next round. For future reference, please Cc: author and reviewers of the
referenced commit.

BR,
Jani.


> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/gpu/drm/i915/intel_device_info.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
> index 3625f777f3a3..d395a09b994f 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.c
> +++ b/drivers/gpu/drm/i915/intel_device_info.c
> @@ -298,7 +298,7 @@ static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv)
>  {
>  	struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu;
>  	u32 fuse;
> -	u8 subslice_mask;
> +	u8 subslice_mask = 0;
>  
>  	fuse = I915_READ(CHV_FUSE_GT);