From: Dan Carpenter <dan.carpenter@linaro.org>
To: Khaled Ali Ahmed <Khaled.AliAhmed@arm.com>
Cc: arm-scmi@vger.kernel.org, Girish Pathak <Girish.Pathak@arm.com>
Subject: [PATCH SCP] module/scmi_pin_control: allow variable length responses
Date: Mon, 28 Apr 2025 12:27:53 +0300 [thread overview]
Message-ID: <aA9KGTuVXZotPEMF@stanley.mountain> (raw)
The PINCTRL_LIST_ASSOCIATIONS and PINCTRL_SETTINGS_GET commands can
return variable length responses. Originally, they were hard coded as
returning only one response. Change the length to -1 and change
scmi_message_validation() to skip the length checking for lengths when
it's -1.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
module/scmi/src/mod_scmi.c | 5 ++++-
module/scmi_pin_control/src/mod_scmi_pin_control.c | 6 ++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/module/scmi/src/mod_scmi.c b/module/scmi/src/mod_scmi.c
index dfaf441fbae5..da4ecc09e13b 100644
--- a/module/scmi/src/mod_scmi.c
+++ b/module/scmi/src/mod_scmi.c
@@ -434,8 +434,11 @@ static int scmi_message_validation(
return (int)SCMI_NOT_FOUND;
}
- if (payload_size != payload_size_table[message_id]) {
+ if (payload_size_table[message_id] != -1 &&
+ payload_size != payload_size_table[message_id]) {
/* Incorrect payload size or message is not supported */
+ FWK_LOG_ERR("invalid message size: message_id=%ld payload_size=%ld vs %ld\n",
+ message_id, payload_size, payload_size_table[message_id]);
return (int)SCMI_PROTOCOL_ERROR;
}
diff --git a/module/scmi_pin_control/src/mod_scmi_pin_control.c b/module/scmi_pin_control/src/mod_scmi_pin_control.c
index 058c89f9512f..2a1095dba9b4 100644
--- a/module/scmi_pin_control/src/mod_scmi_pin_control.c
+++ b/module/scmi_pin_control/src/mod_scmi_pin_control.c
@@ -99,12 +99,10 @@ static const size_t payload_size_table[MOD_SCMI_PIN_CONTROL_COMMAND_COUNT] = {
(unsigned int)sizeof(struct scmi_protocol_message_attributes_a2p),
[MOD_SCMI_PIN_CONTROL_ATTRIBUTES] =
(unsigned int)sizeof(struct scmi_pin_control_attributes_a2p),
- [MOD_SCMI_PIN_CONTROL_LIST_ASSOCIATIONS] =
- (unsigned int)sizeof(struct scmi_pin_control_list_associations_a2p),
- [MOD_SCMI_PIN_CONTROL_SETTINGS_GET] =
- (unsigned int)sizeof(struct scmi_pin_control_settings_get_a2p),
[MOD_SCMI_PIN_CONTROL_SETTINGS_CONFIGURE] =
(unsigned int)sizeof(struct scmi_pin_control_settings_configure_a2p),
+ [MOD_SCMI_PIN_CONTROL_LIST_ASSOCIATIONS] = -1,
+ [MOD_SCMI_PIN_CONTROL_SETTINGS_GET] = -1,
[MOD_SCMI_PIN_CONTROL_REQUEST] =
(unsigned int)sizeof(struct scmi_pin_control_request_a2p),
[MOD_SCMI_PIN_CONTROL_RELEASE] =
--
2.47.2
next reply other threads:[~2025-04-28 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 9:27 Dan Carpenter [this message]
2025-04-28 10:30 ` [PATCH SCP] module/scmi_pin_control: allow variable length responses Khaled Ali Ahmed
2025-04-28 17:32 ` Dan Carpenter
2025-04-29 9:15 ` Khaled Ali Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aA9KGTuVXZotPEMF@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=Girish.Pathak@arm.com \
--cc=Khaled.AliAhmed@arm.com \
--cc=arm-scmi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox