Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58114830 authored by Elliot Berman's avatar Elliot Berman
Browse files

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: default avatarElliot Berman <quic_eberman@quicinc.com>
parent 5708c107
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
// 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__);