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

Commit 27a23d8e authored by Yao Jiang's avatar Yao Jiang Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: hab: add the buffer size sanity check for exporting a buffer



hab only supports multiple page size memory export, so the exported buffer
size must be N * PAGE_SIZE w/ N > 0.

Change-Id: I0b59639b3ca8842ccd49deb6b32f29f68da0b7a4
Signed-off-by: default avatarYao Jiang <yaojia@codeaurora.org>
parent f2be2c18
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -249,7 +249,8 @@ int hab_mem_export(struct uhab_context *ctx,
	int page_count;
	int compressed = 0;

	if (!ctx || !param || !param->buffer)
	if (!ctx || !param || !param->buffer || !param->sizebytes
		|| ((param->sizebytes % PAGE_SIZE) != 0))
		return -EINVAL;

	vchan = hab_get_vchan_fromvcid(param->vcid, ctx, 0);