aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorImre Kis <imre.kis@arm.com>2021-01-12 22:27:20 +0100
committerGyörgy Szing <gyorgy.szing@arm.com>2021-02-02 10:00:13 +0000
commit78f102cc57c9692edf322e540ce4f53f7c147592 (patch)
tree481a93db30ce564ab9dd56fe876b40f80b1d8264
parent21e0665c8f3071c93159f15666203fdd3f6eb803 (diff)
downloadtrusted-services-78f102cc57c9692edf322e540ce4f53f7c147592.tar.gz
libsp: Fix buffer boundary check in sp_discovery
Fix verification if RX buffer can hold returned partition descriptors. Signed-off-by: Imre Kis <imre.kis@arm.com> Change-Id: I062f08816e4de6dc37f4bcd69c114e0cf6ce698e
-rw-r--r--components/messaging/ffa/libsp/sp_discovery.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/messaging/ffa/libsp/sp_discovery.c b/components/messaging/ffa/libsp/sp_discovery.c
index a80116779..1f512a7b9 100644
--- a/components/messaging/ffa/libsp/sp_discovery.c
+++ b/components/messaging/ffa/libsp/sp_discovery.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
/*
- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
*/
#include "sp_discovery.h"
@@ -64,7 +64,7 @@ partition_info_get(const struct sp_uuid *uuid,
return SP_RESULT_FFA(ffa_res);
}
- if (*count * sizeof(struct ffa_partition_information) < buffer_size) {
+ if ((*count * sizeof(struct ffa_partition_information)) > buffer_size) {
/*
* The indicated amount of info structures doesn't fit into the
* RX buffer.