lkml.org 
[lkml]   [2018]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [Intel-gfx] [PATCH][V3] drm/i915/guc: fix GEM_BUG_ON check
Date
From
On Tue, 12 Jun 2018 11:38:04 +0200, Colin King <colin.king@canonical.com>  
wrote:

> From: Colin Ian King <colin.king@canonical.com>
>
> The check for level being less than zero always false because flags
> is currently unsigned and can never be negative. Fix this by making
> level a s32.
>
> Detected by CoverityScan, CID#1468363 ("Macro compares unsigned to 0")
>
> Fixes: cb5d64e9f13e ("drm/i915/guc: Allow user to control default GuC
> logging")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> ---
> V3: Make level s32 and add the missing Fixes: tag, thanks to Dan
> Carpenter and
> Jani Nikula for correcting my mistakes
>
> ---
> drivers/gpu/drm/i915/intel_guc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_guc.c
> b/drivers/gpu/drm/i915/intel_guc.c
> index 116f4ccf1bbd..bdb1fab322bf 100644
> --- a/drivers/gpu/drm/i915/intel_guc.c
> +++ b/drivers/gpu/drm/i915/intel_guc.c
> @@ -205,7 +205,7 @@ void intel_guc_fini(struct intel_guc *guc)
> static u32 get_log_control_flags(void)
> {
> - u32 level = i915_modparams.guc_log_level;
> + s32 level = i915_modparams.guc_log_level;

s/s32 level/int level

to match modparam type as already suggested by others

> u32 flags = 0;
> GEM_BUG_ON(level < 0);

please note that this BUG_ON will go away with pending [1] so maybe
we can just merge series [2] instead ?

Thanks,
Michal

[1] https://patchwork.freedesktop.org/patch/227365/
[2] https://patchwork.freedesktop.org/series/44201/
\
 
 \ /
  Last update: 2018-06-12 14:09    [W:0.021 / U:3.144 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site