Skip to content

Commit bdb8742

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Fix range check for the maximum number of pending messages
SCMI message headers carry a sequence number and such field is sized to allow for MSG_TOKEN_MAX distinct numbers; moreover zero is not really an acceptable maximum number of pending in-flight messages. Fix accordingly the checks performed on the value exported by transports in scmi_desc.max_msg Link: https://lore.kernel.org/r/[email protected] Reported-by: Vincent Guittot <[email protected]> Signed-off-by: Cristian Marussi <[email protected]> [sudeep.holla: updated the patch title and error message] Signed-off-by: Sudeep Holla <[email protected]>
1 parent 187a002 commit bdb8742

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/firmware/arm_scmi/driver.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,9 @@ static int __scmi_xfer_info_init(struct scmi_info *sinfo,
10261026
const struct scmi_desc *desc = sinfo->desc;
10271027

10281028
/* Pre-allocated messages, no more than what hdr.seq can support */
1029-
if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) {
1030-
dev_err(dev, "Maximum message of %d exceeds supported %ld\n",
1029+
if (WARN_ON(!desc->max_msg || desc->max_msg > MSG_TOKEN_MAX)) {
1030+
dev_err(dev,
1031+
"Invalid maximum messages %d, not in range [1 - %lu]\n",
10311032
desc->max_msg, MSG_TOKEN_MAX);
10321033
return -EINVAL;
10331034
}

0 commit comments

Comments
 (0)