virt: haven: Correct max_buf_size for a connection

Continuation messages can carry a maximum payload of
HH_RM_MAX_MSG_SIZE_BYTES. When initializing a connection buffer for
reply sequences, the hdr_size is 4 bytes larger than the
HH_RM_MAX_MSG_SIZE_BYTES: see the difference between
struct hh_rm_rpc_hdr and struct hh_rm_rpc_reply_hdr.

Fix the calculation.

Change-Id: If7a1124f581c9d1da8f7749d0296e064e6499cdf
[eberman: Make change in hh_rm_core.c]
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
This commit is contained in:
Elliot Berman 2023-07-07 15:38:32 -07:00
parent 5708c10730
commit 58114830df

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
*/
@ -114,8 +115,8 @@ hh_rm_init_connection_buff(struct hh_rm_connection *connection,
if (!payload_size)
return 0;
max_buf_size = (HH_MSGQ_MAX_MSG_SIZE_BYTES - hdr_size) *
(hdr->fragments + 1);
max_buf_size = payload_size +
(hdr->fragments * HH_RM_MAX_MSG_SIZE_BYTES);
if (payload_size > max_buf_size) {
pr_err("%s: Payload size exceeds max buff size\n", __func__);