[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250123063441.392555-1-peng.fan@oss.nxp.com>
Date: Thu, 23 Jan 2025 14:34:41 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: sudeep.holla@....com,
cristian.marussi@....com
Cc: arm-scmi@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Peng Fan <peng.fan@....com>,
Jacky Bai <ping.bai@....com>,
Shengjiu Wang <shengjiu.wang@....com>,
Jason Liu <jason.hui.liu@....com>
Subject: [PATCH] firmware: arm_scmi: imx: Correct tx size of scmi_imx_misc_ctrl_set
From: Peng Fan <peng.fan@....com>
'struct scmi_imx_misc_ctrl_set_in' has a zero length array in the end,
so sizeof will not count 'value[]', and txsize is smaller than actual
size for tx,and SCMI firmware will take this protocol error.
Fix this by enlarge the txsize with 'num * 4' to count in the size of
data.
Fixes: 61c9f03e22fc ("firmware: arm_scmi: Add initial support for i.MX MISC protocol")
Reviewed-by: Jacky Bai <ping.bai@....com>
Tested-by: Shengjiu Wang <shengjiu.wang@....com>
Acked-by: Jason Liu <jason.hui.liu@....com>
Signed-off-by: Peng Fan <peng.fan@....com>
---
V1:
Patch is cherry-picked from downstream, so tags are kept.
drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
index 83b69fc4fba5..fe770d7fdde6 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
@@ -254,7 +254,7 @@ static int scmi_imx_misc_ctrl_set(const struct scmi_protocol_handle *ph,
if (num > max_num)
return -EINVAL;
- ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CTRL_SET, sizeof(*in),
+ ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CTRL_SET, sizeof(*in) + num * 4,
0, &t);
if (ret)
return ret;
--
2.37.1
Powered by blists - more mailing lists