[PATCH][drm-next] drm/amd/powerplay: fix off-by-one upper bounds limit checks

Wang, Kevin(Yang) Kevin1.Wang at amd.com
Fri Aug 2 01:45:49 UTC 2019


________________________________
From: Alex Deucher <alexdeucher at gmail.com>
Sent: Friday, August 2, 2019 2:53 AM
To: Colin King <colin.king at canonical.com>
Cc: Wang, Kevin(Yang) <Kevin1.Wang at amd.com>; Rex Zhu <rex.zhu at amd.com>; Quan, Evan <Evan.Quan at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; Zhou, David(ChunMing) <David1.Zhou at amd.com>; David Airlie <airlied at linux.ie>; Daniel Vetter <daniel at ffwll.ch>; amd-gfx list <amd-gfx at lists.freedesktop.org>; Maling list - DRI developers <dri-devel at lists.freedesktop.org>; kernel-janitors at vger.kernel.org <kernel-janitors at vger.kernel.org>; LKML <linux-kernel at vger.kernel.org>
Subject: Re: [PATCH][drm-next] drm/amd/powerplay: fix off-by-one upper bounds limit checks

On Thu, Aug 1, 2019 at 7:15 AM Colin King <colin.king at canonical.com> wrote:
>
> From: Colin Ian King <colin.king at canonical.com>
>
> There are two occurrances of off-by-one upper bound checking of indexes
> causing potential out-of-bounds array reads. Fix these.
>
> Addresses-Coverity: ("Out-of-bounds read")
> Fixes: cb33363d0e85 ("drm/amd/powerplay: add smu feature name support")
> Fixes: 6b294793e384 ("drm/amd/powerplay: add smu message name support")
> Signed-off-by: Colin Ian King <colin.king at canonical.com>

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index d029a99e600e..b64113740eb5 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -38,7 +38,7 @@ static const char* __smu_message_names[] = {
>
>  const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type)
>  {
> -       if (type < 0 || type > SMU_MSG_MAX_COUNT)
> +       if (type < 0 || type >= SMU_MSG_MAX_COUNT)
>                 return "unknown smu message";
>         return __smu_message_names[type];
>  }
> @@ -51,7 +51,7 @@ static const char* __smu_feature_names[] = {
>
>  const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature)
>  {
> -       if (feature < 0 || feature > SMU_FEATURE_COUNT)
> +       if (feature < 0 || feature >= SMU_FEATURE_COUNT)
>                 return "unknown smu feature";
>         return __smu_feature_names[feature];
>  }
[kevin]:
thanks correct it.
Reviewed-by: Kevin Wang <kevin1.wang at amd.com>
BR
Kevin
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190802/5492ba04/attachment.html>


More information about the amd-gfx mailing list