[PATCH] samples: qmi: Fix decoded_size for the ping response handler
From: zhangjiao2
Date: Wed Aug 26 2026 - 05:39:13 EST
From: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
The ping response message handler decodes TEST_PING_REQ_MSG_ID_V01
responses using test_ping_resp_msg_v01_ei and forwards the decoded
message to ping_pong_cb(), which casts the data to
struct test_ping_resp_msg_v01.
However, decoded_size was wrongly set to
sizeof(struct test_ping_req_msg_v01), the request message. Use
sizeof(struct test_ping_resp_msg_v01) instead so the QMI core
allocates a buffer matching the response structure that is being
decoded.
Signed-off-by: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
---
samples/qmi/qmi_sample_client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/qmi/qmi_sample_client.c b/samples/qmi/qmi_sample_client.c
index 247ec5e54c4f..94173b82ae31 100644
--- a/samples/qmi/qmi_sample_client.c
+++ b/samples/qmi/qmi_sample_client.c
@@ -434,7 +434,7 @@ static const struct qmi_msg_handler qmi_sample_handlers[] = {
.type = QMI_RESPONSE,
.msg_id = TEST_PING_REQ_MSG_ID_V01,
.ei = test_ping_resp_msg_v01_ei,
- .decoded_size = sizeof(struct test_ping_req_msg_v01),
+ .decoded_size = sizeof(struct test_ping_resp_msg_v01),
.fn = ping_pong_cb
},
{}
--
2.33.0