kumquat-buildroot/package/optee-client/0002-libteeacl-use-realloc-instead-of-reallocarray.patch
Fabrice Fontaine f5be4abc57 package/optee-client: fix uclibc build
Fix the following uclibc build failure raised since bump to version
3.19.0 in commit 917a961d9c:

/tmp/instance-5/output-1/build/optee-client-3.19.0/libteeacl/src/group.c: In function 'teeacl_user_is_member_of':
/tmp/instance-5/output-1/build/optee-client-3.19.0/libteeacl/src/group.c:75:12: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
   75 |   groups = reallocarray(groups, grouplistsize, sizeof(gid_t));
      |            ^~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/03eba71ab9b87676f2606ecf2a9b5a151fc396bb

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023-02-22 23:23:15 +01:00

35 lines
1.3 KiB
Diff

From dde6306458331371be5df15e3ca953697d2463ef Mon Sep 17 00:00:00 2001
From: Eero Aaltonen <eero.aaltonen@vaisala.com>
Date: Thu, 2 Feb 2023 17:22:29 +0200
Subject: [PATCH] libteeacl: use realloc() instead of reallocarray()
Use realloc() instead of reallocarray(), since uClibc apparently does
not implement reallocarray().
Fixes: https://github.com/OP-TEE/optee_client/issues/339
Signed-off-by: Eero Aaltonen <eero.aaltonen@vaisala.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
[Retrieved from:
https://github.com/OP-TEE/optee_client/commit/dde6306458331371be5df15e3ca953697d2463ef]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
libteeacl/src/group.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libteeacl/src/group.c b/libteeacl/src/group.c
index 10965dd0..bd165a11 100644
--- a/libteeacl/src/group.c
+++ b/libteeacl/src/group.c
@@ -72,7 +72,8 @@ enum rv_groupmember teeacl_user_is_member_of(const char *user, gid_t group)
if (ret == -1) {
p_groups = groups;
- groups = reallocarray(groups, grouplistsize, sizeof(gid_t));
+ /* we use realloc, since uClibc does not implement reallocarray */
+ groups = realloc(groups, grouplistsize * sizeof(gid_t));
if (!groups) {
free(p_groups);
return E_MEMORY;