* [PATCH] accel/amdxdna: Fix uninitialized return value
@ 2025-10-24 16:55 Lizhi Hou
2025-10-24 18:07 ` Mario Limonciello (AMD) (kernel.org)
0 siblings, 1 reply; 3+ messages in thread
From: Lizhi Hou @ 2025-10-24 16:55 UTC (permalink / raw)
To: ogabbay, quic_jhugo, maciej.falkowski, dri-devel
Cc: Lizhi Hou, linux-kernel, max.zhen, sonal.santan, mario.limonciello
In aie2_get_hwctx_status() and aie2_query_ctx_status_array(), the
functions could return an uninitialized value in some cases. Update them
to always return 0. The amount of valid results is indicated by the
returned buffer_size, element_size, and num_element fields.
Fixes: 2f509fe6a42c ("accel/amdxdna: Add ioctl DRM_IOCTL_AMDXDNA_GET_ARRAY")
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
---
drivers/accel/amdxdna/aie2_pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
index f48045318dc0..f1a8112b080f 100644
--- a/drivers/accel/amdxdna/aie2_pci.c
+++ b/drivers/accel/amdxdna/aie2_pci.c
@@ -822,7 +822,7 @@ static int aie2_get_hwctx_status(struct amdxdna_client *client,
}
args->buffer_size -= (u32)(array_args.buffer - args->buffer);
- return ret;
+ return 0;
}
static int aie2_get_info(struct amdxdna_client *client, struct amdxdna_drm_get_info *args)
@@ -904,7 +904,7 @@ static int aie2_query_ctx_status_array(struct amdxdna_client *client,
args->num_element = (u32)((array_args.buffer - args->buffer) /
args->element_size);
- return ret;
+ return 0;
}
static int aie2_get_array(struct amdxdna_client *client,
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] accel/amdxdna: Fix uninitialized return value
2025-10-24 16:55 [PATCH] accel/amdxdna: Fix uninitialized return value Lizhi Hou
@ 2025-10-24 18:07 ` Mario Limonciello (AMD) (kernel.org)
2025-10-24 20:09 ` Lizhi Hou
0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello (AMD) (kernel.org) @ 2025-10-24 18:07 UTC (permalink / raw)
To: Lizhi Hou, ogabbay, quic_jhugo, maciej.falkowski, dri-devel
Cc: linux-kernel, max.zhen, sonal.santan
On 10/24/2025 11:55 AM, Lizhi Hou wrote:
> In aie2_get_hwctx_status() and aie2_query_ctx_status_array(), the
> functions could return an uninitialized value in some cases. Update them
> to always return 0. The amount of valid results is indicated by the
> returned buffer_size, element_size, and num_element fields.
>
> Fixes: 2f509fe6a42c ("accel/amdxdna: Add ioctl DRM_IOCTL_AMDXDNA_GET_ARRAY")
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>> ---
> drivers/accel/amdxdna/aie2_pci.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
> index f48045318dc0..f1a8112b080f 100644
> --- a/drivers/accel/amdxdna/aie2_pci.c
> +++ b/drivers/accel/amdxdna/aie2_pci.c
> @@ -822,7 +822,7 @@ static int aie2_get_hwctx_status(struct amdxdna_client *client,
> }
>
> args->buffer_size -= (u32)(array_args.buffer - args->buffer);
> - return ret;
> + return 0;
> }
>
> static int aie2_get_info(struct amdxdna_client *client, struct amdxdna_drm_get_info *args)
> @@ -904,7 +904,7 @@ static int aie2_query_ctx_status_array(struct amdxdna_client *client,
> args->num_element = (u32)((array_args.buffer - args->buffer) /
> args->element_size);
>
> - return ret;
> + return 0;
> }
>
> static int aie2_get_array(struct amdxdna_client *client,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] accel/amdxdna: Fix uninitialized return value
2025-10-24 18:07 ` Mario Limonciello (AMD) (kernel.org)
@ 2025-10-24 20:09 ` Lizhi Hou
0 siblings, 0 replies; 3+ messages in thread
From: Lizhi Hou @ 2025-10-24 20:09 UTC (permalink / raw)
To: Mario Limonciello (AMD) (kernel.org),
ogabbay, quic_jhugo, maciej.falkowski, dri-devel
Cc: linux-kernel, max.zhen, sonal.santan
Applied to drm-misc-next.
On 10/24/25 11:07, Mario Limonciello (AMD) (kernel.org) wrote:
>
>
> On 10/24/2025 11:55 AM, Lizhi Hou wrote:
>> In aie2_get_hwctx_status() and aie2_query_ctx_status_array(), the
>> functions could return an uninitialized value in some cases. Update them
>> to always return 0. The amount of valid results is indicated by the
>> returned buffer_size, element_size, and num_element fields.
>>
>> Fixes: 2f509fe6a42c ("accel/amdxdna: Add ioctl
>> DRM_IOCTL_AMDXDNA_GET_ARRAY")
>> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>> ---
>> drivers/accel/amdxdna/aie2_pci.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/accel/amdxdna/aie2_pci.c
>> b/drivers/accel/amdxdna/aie2_pci.c
>> index f48045318dc0..f1a8112b080f 100644
>> --- a/drivers/accel/amdxdna/aie2_pci.c
>> +++ b/drivers/accel/amdxdna/aie2_pci.c
>> @@ -822,7 +822,7 @@ static int aie2_get_hwctx_status(struct
>> amdxdna_client *client,
>> }
>> args->buffer_size -= (u32)(array_args.buffer - args->buffer);
>> - return ret;
>> + return 0;
>> }
>> static int aie2_get_info(struct amdxdna_client *client, struct
>> amdxdna_drm_get_info *args)
>> @@ -904,7 +904,7 @@ static int aie2_query_ctx_status_array(struct
>> amdxdna_client *client,
>> args->num_element = (u32)((array_args.buffer - args->buffer) /
>> args->element_size);
>> - return ret;
>> + return 0;
>> }
>> static int aie2_get_array(struct amdxdna_client *client,
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-24 20:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-24 16:55 [PATCH] accel/amdxdna: Fix uninitialized return value Lizhi Hou
2025-10-24 18:07 ` Mario Limonciello (AMD) (kernel.org)
2025-10-24 20:09 ` Lizhi Hou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®