<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Friday, August 2, 2019 2:53 AM<br>
<b>To:</b> Colin King <colin.king@canonical.com><br>
<b>Cc:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; Rex Zhu <rex.zhu@amd.com>; Quan, Evan <Evan.Quan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; David Airlie
 <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; amd-gfx list <amd-gfx@lists.freedesktop.org>; Maling list - DRI developers <dri-devel@lists.freedesktop.org>; kernel-janitors@vger.kernel.org <kernel-janitors@vger.kernel.org>; LKML <linux-kernel@vger.kernel.org><br>
<b>Subject:</b> Re: [PATCH][drm-next] drm/amd/powerplay: fix off-by-one upper bounds limit checks</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">On Thu, Aug 1, 2019 at 7:15 AM Colin King <colin.king@canonical.com> wrote:<br>
><br>
> From: Colin Ian King <colin.king@canonical.com><br>
><br>
> There are two occurrances of off-by-one upper bound checking of indexes<br>
> causing potential out-of-bounds array reads. Fix these.<br>
><br>
> Addresses-Coverity: ("Out-of-bounds read")<br>
> Fixes: cb33363d0e85 ("drm/amd/powerplay: add smu feature name support")<br>
> Fixes: 6b294793e384 ("drm/amd/powerplay: add smu message name support")<br>
> Signed-off-by: Colin Ian King <colin.king@canonical.com><br>
<br>
Applied.  thanks!<br>
<br>
Alex<br>
<br>
> ---<br>
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++--<br>
>  1 file changed, 2 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> index d029a99e600e..b64113740eb5 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> @@ -38,7 +38,7 @@ static const char* __smu_message_names[] = {<br>
><br>
>  const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type)<br>
>  {<br>
> -       if (type < 0 || type > SMU_MSG_MAX_COUNT)<br>
> +       if (type < 0 || type >= SMU_MSG_MAX_COUNT)<br>
>                 return "unknown smu message";<br>
>         return __smu_message_names[type];<br>
>  }<br>
> @@ -51,7 +51,7 @@ static const char* __smu_feature_names[] = {<br>
><br>
>  const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature)<br>
>  {<br>
> -       if (feature < 0 || feature > SMU_FEATURE_COUNT)<br>
> +       if (feature < 0 || feature >= SMU_FEATURE_COUNT)<br>
>                 return "unknown smu feature";<br>
>         return __smu_feature_names[feature];<br>
>  }</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">thanks correct it.<br>
</div>
<div class="PlainText">Reviewed-by: Kevin Wang <kevin1.wang@amd.com></div>
<div class="PlainText">BR<br>
</div>
<div class="PlainText">Kevin</div>
<div class="PlainText">> --<br>
> 2.20.1<br>
><br>
> _______________________________________________<br>
> dri-devel mailing list<br>
> dri-devel@lists.freedesktop.org<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</div>
</span></font></div>
</body>
</html>