* [PATCH] drm/amdkfd: Fix static checker warning on MES queue type
@ 2022-05-12 19:16 Graham Sider
2022-05-12 21:32 ` Alex Deucher
2022-05-12 21:35 ` Felix Kuehling
0 siblings, 2 replies; 4+ messages in thread
From: Graham Sider @ 2022-05-12 19:16 UTC (permalink / raw)
To: amd-gfx; +Cc: Mukul.Joshi, Felix.Kuehling, Graham Sider, dan.carpenter
convert_to_mes_queue_type return can be negative, but
queue_input.queue_type is uint32_t. Put return in integer var and cast
to unsigned after negative check.
Signed-off-by: Graham Sider <Graham.Sider@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index e9c9a3a67ab0..e1797657b04c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -176,7 +176,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev->adev;
struct kfd_process_device *pdd = qpd_to_pdd(qpd);
struct mes_add_queue_input queue_input;
- int r;
+ int r, queue_type;
if (dqm->is_hws_hang)
return -EIO;
@@ -201,12 +201,13 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
queue_input.tba_addr = qpd->tba_addr;
queue_input.tma_addr = qpd->tma_addr;
- queue_input.queue_type = convert_to_mes_queue_type(q->properties.type);
- if (queue_input.queue_type < 0) {
+ queue_type = convert_to_mes_queue_type(q->properties.type);
+ if (queue_type < 0) {
pr_err("Queue type not supported with MES, queue:%d\n",
q->properties.type);
return -EINVAL;
}
+ queue_input.queue_type = (uint32_t)queue_type;
if (q->gws) {
queue_input.gws_base = 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdkfd: Fix static checker warning on MES queue type
2022-05-12 19:16 [PATCH] drm/amdkfd: Fix static checker warning on MES queue type Graham Sider
@ 2022-05-12 21:32 ` Alex Deucher
2022-05-12 22:32 ` Sider, Graham
2022-05-12 21:35 ` Felix Kuehling
1 sibling, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2022-05-12 21:32 UTC (permalink / raw)
To: Graham Sider; +Cc: Joshi, Mukul, Kuehling, Felix, Dan Carpenter, amd-gfx list
On Thu, May 12, 2022 at 3:17 PM Graham Sider <Graham.Sider@amd.com> wrote:
>
> convert_to_mes_queue_type return can be negative, but
> queue_input.queue_type is uint32_t. Put return in integer var and cast
> to unsigned after negative check.
>
> Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Add a reported-by for Dan's email?
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index e9c9a3a67ab0..e1797657b04c 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -176,7 +176,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
> struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev->adev;
> struct kfd_process_device *pdd = qpd_to_pdd(qpd);
> struct mes_add_queue_input queue_input;
> - int r;
> + int r, queue_type;
>
> if (dqm->is_hws_hang)
> return -EIO;
> @@ -201,12 +201,13 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
> queue_input.tba_addr = qpd->tba_addr;
> queue_input.tma_addr = qpd->tma_addr;
>
> - queue_input.queue_type = convert_to_mes_queue_type(q->properties.type);
> - if (queue_input.queue_type < 0) {
> + queue_type = convert_to_mes_queue_type(q->properties.type);
> + if (queue_type < 0) {
> pr_err("Queue type not supported with MES, queue:%d\n",
> q->properties.type);
> return -EINVAL;
> }
> + queue_input.queue_type = (uint32_t)queue_type;
>
> if (q->gws) {
> queue_input.gws_base = 0;
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdkfd: Fix static checker warning on MES queue type
2022-05-12 19:16 [PATCH] drm/amdkfd: Fix static checker warning on MES queue type Graham Sider
2022-05-12 21:32 ` Alex Deucher
@ 2022-05-12 21:35 ` Felix Kuehling
1 sibling, 0 replies; 4+ messages in thread
From: Felix Kuehling @ 2022-05-12 21:35 UTC (permalink / raw)
To: Graham Sider, amd-gfx; +Cc: Mukul.Joshi, dan.carpenter
Am 2022-05-12 um 15:16 schrieb Graham Sider:
> convert_to_mes_queue_type return can be negative, but
> queue_input.queue_type is uint32_t. Put return in integer var and cast
> to unsigned after negative check.
>
> Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index e9c9a3a67ab0..e1797657b04c 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -176,7 +176,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
> struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev->adev;
> struct kfd_process_device *pdd = qpd_to_pdd(qpd);
> struct mes_add_queue_input queue_input;
> - int r;
> + int r, queue_type;
>
> if (dqm->is_hws_hang)
> return -EIO;
> @@ -201,12 +201,13 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
> queue_input.tba_addr = qpd->tba_addr;
> queue_input.tma_addr = qpd->tma_addr;
>
> - queue_input.queue_type = convert_to_mes_queue_type(q->properties.type);
> - if (queue_input.queue_type < 0) {
> + queue_type = convert_to_mes_queue_type(q->properties.type);
> + if (queue_type < 0) {
> pr_err("Queue type not supported with MES, queue:%d\n",
> q->properties.type);
> return -EINVAL;
> }
> + queue_input.queue_type = (uint32_t)queue_type;
>
> if (q->gws) {
> queue_input.gws_base = 0;
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] drm/amdkfd: Fix static checker warning on MES queue type
2022-05-12 21:32 ` Alex Deucher
@ 2022-05-12 22:32 ` Sider, Graham
0 siblings, 0 replies; 4+ messages in thread
From: Sider, Graham @ 2022-05-12 22:32 UTC (permalink / raw)
To: Alex Deucher; +Cc: Joshi, Mukul, Kuehling, Felix, Dan Carpenter, amd-gfx list
[AMD Official Use Only - General]
Thanks for mentioning, yes I'll add a reported-by for Dan on the commit.
Best,
Graham
> -----Original Message-----
> From: Alex Deucher <alexdeucher@gmail.com>
> Sent: Thursday, May 12, 2022 5:33 PM
> To: Sider, Graham <Graham.Sider@amd.com>
> Cc: amd-gfx list <amd-gfx@lists.freedesktop.org>; Joshi, Mukul
> <Mukul.Joshi@amd.com>; Kuehling, Felix <Felix.Kuehling@amd.com>; Dan
> Carpenter <dan.carpenter@oracle.com>
> Subject: Re: [PATCH] drm/amdkfd: Fix static checker warning on MES queue
> type
>
> [CAUTION: External Email]
>
> On Thu, May 12, 2022 at 3:17 PM Graham Sider <Graham.Sider@amd.com>
> wrote:
> >
> > convert_to_mes_queue_type return can be negative, but
> > queue_input.queue_type is uint32_t. Put return in integer var and cast
> > to unsigned after negative check.
> >
> > Signed-off-by: Graham Sider <Graham.Sider@amd.com>
>
> Add a reported-by for Dan's email?
>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>
> > ---
> > drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> > b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> > index e9c9a3a67ab0..e1797657b04c 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> > @@ -176,7 +176,7 @@ static int add_queue_mes(struct
> device_queue_manager *dqm, struct queue *q,
> > struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev-
> >adev;
> > struct kfd_process_device *pdd = qpd_to_pdd(qpd);
> > struct mes_add_queue_input queue_input;
> > - int r;
> > + int r, queue_type;
> >
> > if (dqm->is_hws_hang)
> > return -EIO;
> > @@ -201,12 +201,13 @@ static int add_queue_mes(struct
> device_queue_manager *dqm, struct queue *q,
> > queue_input.tba_addr = qpd->tba_addr;
> > queue_input.tma_addr = qpd->tma_addr;
> >
> > - queue_input.queue_type = convert_to_mes_queue_type(q-
> >properties.type);
> > - if (queue_input.queue_type < 0) {
> > + queue_type = convert_to_mes_queue_type(q->properties.type);
> > + if (queue_type < 0) {
> > pr_err("Queue type not supported with MES, queue:%d\n",
> > q->properties.type);
> > return -EINVAL;
> > }
> > + queue_input.queue_type = (uint32_t)queue_type;
> >
> > if (q->gws) {
> > queue_input.gws_base = 0;
> > --
> > 2.25.1
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-12 22:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 19:16 [PATCH] drm/amdkfd: Fix static checker warning on MES queue type Graham Sider
2022-05-12 21:32 ` Alex Deucher
2022-05-12 22:32 ` Sider, Graham
2022-05-12 21:35 ` Felix Kuehling
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.