Skip to contentSkip to conversation

accel/amdxdna: Fix uninitialized return value

PATCH In review Lizhi Hou 2 participants 3 messages Oct 24, 2025

Subsystems (2)
lore
Share & tools
lore

Lizhi Hou

author maintainer
#0 lore raw

PATCH 1/1 accel/amdxdna: Fix uninitialized return value

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")
---
 drivers/accel/amdxdna/aie2_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/accel/amdxdna/aie2_pci.c +2 -2
index f48045318dc0..f1a8112b080f 100644
@@ -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,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Lizhi Hou

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")
Quoted 25 lines
  drivers/accel/amdxdna/aie2_pci.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/accel/amdxdna/aie2_pci.c +2 -2
index f48045318dc0..f1a8112b080f 100644
@@ -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,
author maintainer Applied
#2 lore raw

Applied to drm-misc-next.

Quoted 35 lines · Mario Limonciello (AMD) (kernel.org)
Quoted 7 lines · Lizhi Hou

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")
Quoted 23 lines

  drivers/accel/amdxdna/aie2_pci.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/accel/amdxdna/aie2_pci.c +1 -1
index f48045318dc0..f1a8112b080f 100644
@@ -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,