Skip to contentSkip to conversation

fwctl: pds: report device information length

PATCH Applied Avi Weiss 3 participants 3 messages Oct 28 – Nov 18

Subsystems (2)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 fwctl: pds: report device information length

pdsfc_info() allocates and populates struct fwctl_info_pds but leaves the output length unset. Consequently, fwctl_cmd_info() copies no PDS-specific data and reports a zero device_data_len even when userspace provides an output buffer.

Set *length to sizeof(*info) before returning the structure.

Fixes 4d09dd11d7d0 ("pds_fwctl: initial driver framework")
---
 drivers/fwctl/pds/main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/fwctl/pds/main.c +1 -0
index 68fe254dd10ad..01abc7e83975f 100644
@@ -63,6 +63,7 @@ static void *pdsfc_info(struct fwctl_uctx *uctx, size_t *length)
 		return ERR_PTR(-ENOMEM);
 
 	info->uctx_caps = pdsfc_uctx->uctx_caps;
+	*length = sizeof(*info);
 
 	return info;
 }

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935

Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Avi Weiss

pdsfc_info() allocates and populates struct fwctl_info_pds but leaves the output length unset. Consequently, fwctl_cmd_info() copies no PDS-specific data and reports a zero device_data_len even when userspace provides an output buffer.

Set *length to sizeof(*info) before returning the structure.

Fixes 4d09dd11d7d0 ("pds_fwctl: initial driver framework")

Looks pretty straight forward fix

Quoted 18 lines
---
 drivers/fwctl/pds/main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/fwctl/pds/main.c +1 -0
index 68fe254dd10ad..01abc7e83975f 100644
@@ -63,6 +63,7 @@ static void *pdsfc_info(struct fwctl_uctx *uctx, size_t *length)
 		return ERR_PTR(-ENOMEM);
 
 	info->uctx_caps = pdsfc_uctx->uctx_caps;
+	*length = sizeof(*info);
 
 	return info;
 }

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935