* [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-18 22:48 ` Nathan Chancellor
0 siblings, 0 replies; 12+ messages in thread
From: Nathan Chancellor @ 2021-02-18 22:48 UTC (permalink / raw)
To: Alex Deucher, Christian König
Cc: Nick Desaulniers, Kevin Wang, amd-gfx, dri-devel, linux-kernel,
clang-built-linux, Nathan Chancellor
Clang warns:
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
variable 'structure_size' is used uninitialized whenever switch default
is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
uninitialized use occurs here
memset(header, 0xFF, structure_size);
^~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
initialize the variable 'structure_size' to silence this warning
uint16_t structure_size;
^
= 0
1 warning generated.
Return in the default case, as the size of the header will not be known.
Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
Link: https://github.com/ClangBuiltLinux/linux/issues/1304
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
index bb620fdd4cd2..bcedd4d92e35 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
@@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
structure_size = sizeof(struct gpu_metrics_v2_0);
break;
default:
- break;
+ return;
}
#undef METRICS_VERSION
--
2.30.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-18 22:48 ` Nathan Chancellor
0 siblings, 0 replies; 12+ messages in thread
From: Nathan Chancellor @ 2021-02-18 22:48 UTC (permalink / raw)
To: Alex Deucher, Christian König
Cc: Kevin Wang, Nick Desaulniers, linux-kernel, dri-devel,
Nathan Chancellor, clang-built-linux, amd-gfx
Clang warns:
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
variable 'structure_size' is used uninitialized whenever switch default
is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
uninitialized use occurs here
memset(header, 0xFF, structure_size);
^~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
initialize the variable 'structure_size' to silence this warning
uint16_t structure_size;
^
= 0
1 warning generated.
Return in the default case, as the size of the header will not be known.
Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
Link: https://github.com/ClangBuiltLinux/linux/issues/1304
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
index bb620fdd4cd2..bcedd4d92e35 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
@@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
structure_size = sizeof(struct gpu_metrics_v2_0);
break;
default:
- break;
+ return;
}
#undef METRICS_VERSION
--
2.30.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-18 22:48 ` Nathan Chancellor
0 siblings, 0 replies; 12+ messages in thread
From: Nathan Chancellor @ 2021-02-18 22:48 UTC (permalink / raw)
To: Alex Deucher, Christian König
Cc: Kevin Wang, Nick Desaulniers, linux-kernel, dri-devel,
Nathan Chancellor, clang-built-linux, amd-gfx
Clang warns:
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
variable 'structure_size' is used uninitialized whenever switch default
is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
uninitialized use occurs here
memset(header, 0xFF, structure_size);
^~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
initialize the variable 'structure_size' to silence this warning
uint16_t structure_size;
^
= 0
1 warning generated.
Return in the default case, as the size of the header will not be known.
Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
Link: https://github.com/ClangBuiltLinux/linux/issues/1304
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
index bb620fdd4cd2..bcedd4d92e35 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
@@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
structure_size = sizeof(struct gpu_metrics_v2_0);
break;
default:
- break;
+ return;
}
#undef METRICS_VERSION
--
2.30.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
2021-02-18 22:48 ` Nathan Chancellor
(?)
@ 2021-02-18 23:12 ` Wang, Kevin(Yang)
-1 siblings, 0 replies; 12+ messages in thread
From: Wang, Kevin(Yang) @ 2021-02-18 23:12 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Deucher, Alexander, Koenig, Christian, Nick Desaulniers, amd-gfx,
dri-devel, linux-kernel, clang-built-linux
thanks,
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Regards,
Kevin
> 在 2021年2月19日,06:49,Nathan Chancellor <nathan@kernel.org> 写道:
>
> Clang warns:
>
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> variable 'structure_size' is used uninitialized whenever switch default
> is taken [-Wsometimes-uninitialized]
> default:
> ^~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> uninitialized use occurs here
> memset(header, 0xFF, structure_size);
> ^~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> initialize the variable 'structure_size' to silence this warning
> uint16_t structure_size;
> ^
> = 0
> 1 warning generated.
>
> Return in the default case, as the size of the header will not be known.
>
> Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> index bb620fdd4cd2..bcedd4d92e35 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> structure_size = sizeof(struct gpu_metrics_v2_0);
> break;
> default:
> - break;
> + return;
> }
>
> #undef METRICS_VERSION
> --
> 2.30.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-18 23:12 ` Wang, Kevin(Yang)
0 siblings, 0 replies; 12+ messages in thread
From: Wang, Kevin(Yang) @ 2021-02-18 23:12 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Nick Desaulniers, linux-kernel, dri-devel, clang-built-linux,
amd-gfx, Deucher, Alexander, Koenig, Christian
thanks,
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Regards,
Kevin
> 在 2021年2月19日,06:49,Nathan Chancellor <nathan@kernel.org> 写道:
>
> Clang warns:
>
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> variable 'structure_size' is used uninitialized whenever switch default
> is taken [-Wsometimes-uninitialized]
> default:
> ^~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> uninitialized use occurs here
> memset(header, 0xFF, structure_size);
> ^~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> initialize the variable 'structure_size' to silence this warning
> uint16_t structure_size;
> ^
> = 0
> 1 warning generated.
>
> Return in the default case, as the size of the header will not be known.
>
> Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> index bb620fdd4cd2..bcedd4d92e35 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> structure_size = sizeof(struct gpu_metrics_v2_0);
> break;
> default:
> - break;
> + return;
> }
>
> #undef METRICS_VERSION
> --
> 2.30.1
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-18 23:12 ` Wang, Kevin(Yang)
0 siblings, 0 replies; 12+ messages in thread
From: Wang, Kevin(Yang) @ 2021-02-18 23:12 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Nick Desaulniers, linux-kernel, dri-devel, clang-built-linux,
amd-gfx, Deucher, Alexander, Koenig, Christian
thanks,
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Regards,
Kevin
> 在 2021年2月19日,06:49,Nathan Chancellor <nathan@kernel.org> 写道:
>
> Clang warns:
>
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> variable 'structure_size' is used uninitialized whenever switch default
> is taken [-Wsometimes-uninitialized]
> default:
> ^~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> uninitialized use occurs here
> memset(header, 0xFF, structure_size);
> ^~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> initialize the variable 'structure_size' to silence this warning
> uint16_t structure_size;
> ^
> = 0
> 1 warning generated.
>
> Return in the default case, as the size of the header will not be known.
>
> Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> index bb620fdd4cd2..bcedd4d92e35 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> structure_size = sizeof(struct gpu_metrics_v2_0);
> break;
> default:
> - break;
> + return;
> }
>
> #undef METRICS_VERSION
> --
> 2.30.1
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
2021-02-18 23:12 ` Wang, Kevin(Yang)
(?)
@ 2021-02-22 21:38 ` Alex Deucher
-1 siblings, 0 replies; 12+ messages in thread
From: Alex Deucher @ 2021-02-22 21:38 UTC (permalink / raw)
To: Wang, Kevin(Yang)
Cc: Nathan Chancellor, Nick Desaulniers, linux-kernel, dri-devel,
clang-built-linux, amd-gfx, Deucher, Alexander, Koenig,
Christian
Applied. Thanks!
Alex
On Thu, Feb 18, 2021 at 6:12 PM Wang, Kevin(Yang) <Kevin1.Wang@amd.com> wrote:
>
> thanks,
>
> Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
>
> Regards,
> Kevin
>
> > 在 2021年2月19日,06:49,Nathan Chancellor <nathan@kernel.org> 写道:
> >
> > Clang warns:
> >
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> > variable 'structure_size' is used uninitialized whenever switch default
> > is taken [-Wsometimes-uninitialized]
> > default:
> > ^~~~~~~
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> > uninitialized use occurs here
> > memset(header, 0xFF, structure_size);
> > ^~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> > initialize the variable 'structure_size' to silence this warning
> > uint16_t structure_size;
> > ^
> > = 0
> > 1 warning generated.
> >
> > Return in the default case, as the size of the header will not be known.
> >
> > Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > index bb620fdd4cd2..bcedd4d92e35 100644
> > --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> > structure_size = sizeof(struct gpu_metrics_v2_0);
> > break;
> > default:
> > - break;
> > + return;
> > }
> >
> > #undef METRICS_VERSION
> > --
> > 2.30.1
> >
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-22 21:38 ` Alex Deucher
0 siblings, 0 replies; 12+ messages in thread
From: Alex Deucher @ 2021-02-22 21:38 UTC (permalink / raw)
To: Wang, Kevin(Yang)
Cc: Nick Desaulniers, linux-kernel, amd-gfx, Nathan Chancellor,
clang-built-linux, dri-devel, Deucher, Alexander, Koenig,
Christian
Applied. Thanks!
Alex
On Thu, Feb 18, 2021 at 6:12 PM Wang, Kevin(Yang) <Kevin1.Wang@amd.com> wrote:
>
> thanks,
>
> Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
>
> Regards,
> Kevin
>
> > 在 2021年2月19日,06:49,Nathan Chancellor <nathan@kernel.org> 写道:
> >
> > Clang warns:
> >
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> > variable 'structure_size' is used uninitialized whenever switch default
> > is taken [-Wsometimes-uninitialized]
> > default:
> > ^~~~~~~
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> > uninitialized use occurs here
> > memset(header, 0xFF, structure_size);
> > ^~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> > initialize the variable 'structure_size' to silence this warning
> > uint16_t structure_size;
> > ^
> > = 0
> > 1 warning generated.
> >
> > Return in the default case, as the size of the header will not be known.
> >
> > Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > index bb620fdd4cd2..bcedd4d92e35 100644
> > --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> > structure_size = sizeof(struct gpu_metrics_v2_0);
> > break;
> > default:
> > - break;
> > + return;
> > }
> >
> > #undef METRICS_VERSION
> > --
> > 2.30.1
> >
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-22 21:38 ` Alex Deucher
0 siblings, 0 replies; 12+ messages in thread
From: Alex Deucher @ 2021-02-22 21:38 UTC (permalink / raw)
To: Wang, Kevin(Yang)
Cc: Nick Desaulniers, linux-kernel, amd-gfx, Nathan Chancellor,
clang-built-linux, dri-devel, Deucher, Alexander, Koenig,
Christian
Applied. Thanks!
Alex
On Thu, Feb 18, 2021 at 6:12 PM Wang, Kevin(Yang) <Kevin1.Wang@amd.com> wrote:
>
> thanks,
>
> Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
>
> Regards,
> Kevin
>
> > 在 2021年2月19日,06:49,Nathan Chancellor <nathan@kernel.org> 写道:
> >
> > Clang warns:
> >
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> > variable 'structure_size' is used uninitialized whenever switch default
> > is taken [-Wsometimes-uninitialized]
> > default:
> > ^~~~~~~
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> > uninitialized use occurs here
> > memset(header, 0xFF, structure_size);
> > ^~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> > initialize the variable 'structure_size' to silence this warning
> > uint16_t structure_size;
> > ^
> > = 0
> > 1 warning generated.
> >
> > Return in the default case, as the size of the header will not be known.
> >
> > Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > index bb620fdd4cd2..bcedd4d92e35 100644
> > --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> > @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> > structure_size = sizeof(struct gpu_metrics_v2_0);
> > break;
> > default:
> > - break;
> > + return;
> > }
> >
> > #undef METRICS_VERSION
> > --
> > 2.30.1
> >
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
2021-02-18 22:48 ` Nathan Chancellor
(?)
@ 2021-02-24 17:40 ` Sedat Dilek
-1 siblings, 0 replies; 12+ messages in thread
From: Sedat Dilek @ 2021-02-24 17:40 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Alex Deucher, Christian König, Nick Desaulniers, Kevin Wang,
amd-gfx, dri-devel, linux-kernel, Clang-Built-Linux ML
On Thu, Feb 18, 2021 at 11:49 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Clang warns:
>
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> variable 'structure_size' is used uninitialized whenever switch default
> is taken [-Wsometimes-uninitialized]
> default:
> ^~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> uninitialized use occurs here
> memset(header, 0xFF, structure_size);
> ^~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> initialize the variable 'structure_size' to silence this warning
> uint16_t structure_size;
> ^
> = 0
> 1 warning generated.
>
> Return in the default case, as the size of the header will not be known.
>
> Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
I fell over this today with Linux v5.11-10201-gc03c21ba6f4e.
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v13-git
- Sedat -
> ---
> drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> index bb620fdd4cd2..bcedd4d92e35 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> structure_size = sizeof(struct gpu_metrics_v2_0);
> break;
> default:
> - break;
> + return;
> }
>
> #undef METRICS_VERSION
> --
> 2.30.1
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210218224849.5591-1-nathan%40kernel.org.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-24 17:40 ` Sedat Dilek
0 siblings, 0 replies; 12+ messages in thread
From: Sedat Dilek @ 2021-02-24 17:40 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Kevin Wang, Nick Desaulniers, linux-kernel, dri-devel,
Clang-Built-Linux ML, amd-gfx, Alex Deucher,
Christian König
On Thu, Feb 18, 2021 at 11:49 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Clang warns:
>
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> variable 'structure_size' is used uninitialized whenever switch default
> is taken [-Wsometimes-uninitialized]
> default:
> ^~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> uninitialized use occurs here
> memset(header, 0xFF, structure_size);
> ^~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> initialize the variable 'structure_size' to silence this warning
> uint16_t structure_size;
> ^
> = 0
> 1 warning generated.
>
> Return in the default case, as the size of the header will not be known.
>
> Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
I fell over this today with Linux v5.11-10201-gc03c21ba6f4e.
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v13-git
- Sedat -
> ---
> drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> index bb620fdd4cd2..bcedd4d92e35 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> structure_size = sizeof(struct gpu_metrics_v2_0);
> break;
> default:
> - break;
> + return;
> }
>
> #undef METRICS_VERSION
> --
> 2.30.1
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210218224849.5591-1-nathan%40kernel.org.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics
@ 2021-02-24 17:40 ` Sedat Dilek
0 siblings, 0 replies; 12+ messages in thread
From: Sedat Dilek @ 2021-02-24 17:40 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Kevin Wang, Nick Desaulniers, linux-kernel, dri-devel,
Clang-Built-Linux ML, amd-gfx, Alex Deucher,
Christian König
On Thu, Feb 18, 2021 at 11:49 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Clang warns:
>
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning:
> variable 'structure_size' is used uninitialized whenever switch default
> is taken [-Wsometimes-uninitialized]
> default:
> ^~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note:
> uninitialized use occurs here
> memset(header, 0xFF, structure_size);
> ^~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note:
> initialize the variable 'structure_size' to silence this warning
> uint16_t structure_size;
> ^
> = 0
> 1 warning generated.
>
> Return in the default case, as the size of the header will not be known.
>
> Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics function")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1304
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
I fell over this today with Linux v5.11-10201-gc03c21ba6f4e.
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v13-git
- Sedat -
> ---
> drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> index bb620fdd4cd2..bcedd4d92e35 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
> structure_size = sizeof(struct gpu_metrics_v2_0);
> break;
> default:
> - break;
> + return;
> }
>
> #undef METRICS_VERSION
> --
> 2.30.1
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210218224849.5591-1-nathan%40kernel.org.
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-02-24 23:03 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 22:48 [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics Nathan Chancellor
2021-02-18 22:48 ` Nathan Chancellor
2021-02-18 22:48 ` Nathan Chancellor
2021-02-18 23:12 ` Wang, Kevin(Yang)
2021-02-18 23:12 ` Wang, Kevin(Yang)
2021-02-18 23:12 ` Wang, Kevin(Yang)
2021-02-22 21:38 ` Alex Deucher
2021-02-22 21:38 ` Alex Deucher
2021-02-22 21:38 ` Alex Deucher
2021-02-24 17:40 ` Sedat Dilek
2021-02-24 17:40 ` Sedat Dilek
2021-02-24 17:40 ` Sedat Dilek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.