dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] accel/amdxdna: Fix incorrect type used for a local variable
@ 2025-08-26 16:03 Lizhi Hou
  2025-08-26 16:50 ` Mario Limonciello
  0 siblings, 1 reply; 3+ messages in thread
From: Lizhi Hou @ 2025-08-26 16:03 UTC (permalink / raw)
  To: ogabbay, quic_jhugo, jacek.lawrynowicz, dri-devel
  Cc: Lizhi Hou, linux-kernel, max.zhen, sonal.santan,
	mario.limonciello, kernel test robot

drivers/accel/amdxdna/aie2_pci.c:794:13: sparse: sparse: incorrect type in assignment (different address spaces)

Fixes: c8cea4371e5e ("accel/amdxdna: Add a function to walk hardware contexts")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508230855.0b9efFl6-lkp@intel.com/
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
---
 drivers/accel/amdxdna/aie2_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
index 16ac0cab4f44..2885a3c17e89 100644
--- a/drivers/accel/amdxdna/aie2_pci.c
+++ b/drivers/accel/amdxdna/aie2_pci.c
@@ -785,7 +785,7 @@ static int aie2_get_clock_metadata(struct amdxdna_client *client,
 
 static int aie2_hwctx_status_cb(struct amdxdna_hwctx *hwctx, void *arg)
 {
-	struct amdxdna_drm_query_hwctx __user *buf, *tmp __free(kfree) = NULL;
+	struct amdxdna_drm_query_hwctx *tmp __free(kfree) = NULL, __user *buf;
 	struct amdxdna_drm_get_info *get_info_args = arg;
 
 	if (get_info_args->buffer_size < sizeof(*tmp))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] accel/amdxdna: Fix incorrect type used for a local variable
  2025-08-26 16:03 [PATCH] accel/amdxdna: Fix incorrect type used for a local variable Lizhi Hou
@ 2025-08-26 16:50 ` Mario Limonciello
  2025-08-26 17:15   ` Lizhi Hou
  0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2025-08-26 16:50 UTC (permalink / raw)
  To: Lizhi Hou, ogabbay, quic_jhugo, jacek.lawrynowicz, dri-devel
  Cc: linux-kernel, max.zhen, sonal.santan, kernel test robot

On 8/26/2025 11:03 AM, Lizhi Hou wrote:
> drivers/accel/amdxdna/aie2_pci.c:794:13: sparse: sparse: incorrect type in assignment (different address spaces)
> 
> Fixes: c8cea4371e5e ("accel/amdxdna: Add a function to walk hardware contexts")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508230855.0b9efFl6-lkp@intel.com/
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> ---
>   drivers/accel/amdxdna/aie2_pci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
> index 16ac0cab4f44..2885a3c17e89 100644
> --- a/drivers/accel/amdxdna/aie2_pci.c
> +++ b/drivers/accel/amdxdna/aie2_pci.c
> @@ -785,7 +785,7 @@ static int aie2_get_clock_metadata(struct amdxdna_client *client,
>   
>   static int aie2_hwctx_status_cb(struct amdxdna_hwctx *hwctx, void *arg)
>   {
> -	struct amdxdna_drm_query_hwctx __user *buf, *tmp __free(kfree) = NULL;
> +	struct amdxdna_drm_query_hwctx *tmp __free(kfree) = NULL, __user *buf;

IMO it would be better to just split these into two separate 
declarations so that we don't have to worry about nuance of order of 
operations resolving the type.

>   	struct amdxdna_drm_get_info *get_info_args = arg;
>   
>   	if (get_info_args->buffer_size < sizeof(*tmp))


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] accel/amdxdna: Fix incorrect type used for a local variable
  2025-08-26 16:50 ` Mario Limonciello
@ 2025-08-26 17:15   ` Lizhi Hou
  0 siblings, 0 replies; 3+ messages in thread
From: Lizhi Hou @ 2025-08-26 17:15 UTC (permalink / raw)
  To: Mario Limonciello, ogabbay, quic_jhugo, jacek.lawrynowicz,
	dri-devel
  Cc: linux-kernel, max.zhen, sonal.santan, kernel test robot


On 8/26/25 09:50, Mario Limonciello wrote:
> On 8/26/2025 11:03 AM, Lizhi Hou wrote:
>> drivers/accel/amdxdna/aie2_pci.c:794:13: sparse: sparse: incorrect 
>> type in assignment (different address spaces)
>>
>> Fixes: c8cea4371e5e ("accel/amdxdna: Add a function to walk hardware 
>> contexts")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: 
>> https://lore.kernel.org/oe-kbuild-all/202508230855.0b9efFl6-lkp@intel.com/
>> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
>> ---
>>   drivers/accel/amdxdna/aie2_pci.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/accel/amdxdna/aie2_pci.c 
>> b/drivers/accel/amdxdna/aie2_pci.c
>> index 16ac0cab4f44..2885a3c17e89 100644
>> --- a/drivers/accel/amdxdna/aie2_pci.c
>> +++ b/drivers/accel/amdxdna/aie2_pci.c
>> @@ -785,7 +785,7 @@ static int aie2_get_clock_metadata(struct 
>> amdxdna_client *client,
>>     static int aie2_hwctx_status_cb(struct amdxdna_hwctx *hwctx, void 
>> *arg)
>>   {
>> -    struct amdxdna_drm_query_hwctx __user *buf, *tmp __free(kfree) = 
>> NULL;
>> +    struct amdxdna_drm_query_hwctx *tmp __free(kfree) = NULL, __user 
>> *buf;
>
> IMO it would be better to just split these into two separate 
> declarations so that we don't have to worry about nuance of order of 
> operations resolving the type.

Sure.


Thanks,

Lizhi

>
>>       struct amdxdna_drm_get_info *get_info_args = arg;
>>         if (get_info_args->buffer_size < sizeof(*tmp))
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-26 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 16:03 [PATCH] accel/amdxdna: Fix incorrect type used for a local variable Lizhi Hou
2025-08-26 16:50 ` Mario Limonciello
2025-08-26 17:15   ` Lizhi Hou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).