kumquat-buildroot/package/optee-test/0001-regression-4100-update-string-conversion-loop.patch
Etienne Carriere 7d1080a1b4 package/optee-test: new package
OP-TEE test package provide test materials as part of the OP-TEE
project helping platforms to verify their OP-TEE components
against a set of regression and performance tests.

Package is added in the BR package configuration next to the
OP-TEE client package.

This change references in Buildroot the today's latest OP-TEE
revision release tagged 3.4.0 with an added patch to fix an issue
reported by recent GCC toolchains.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
[Thomas:
 - drop version selection
 - propagate !BR2_STATIC_LIBS dependency of optee-client
 - make sure BR2_TARGET_OPTEE_OS_SDK is selected
 - use a patch generated by git format-patch
 - simplify the construct to build the examples]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-02-17 22:49:08 +01:00

73 lines
2.1 KiB
Diff

From 88714fc174b91950c9e1c53a9832fc6d4ffa6e2a Mon Sep 17 00:00:00 2001
From: Etienne Carriere <etienne.carriere@linaro.org>
Date: Sun, 17 Feb 2019 22:44:44 +0100
Subject: [PATCH] regression 4100: update string conversion loop
Change the loop used to convert string into numerical value.
The original loop was fine but its implementation hits toolchain
unsafe-loop-optimizations feature. The new implementation
proposed here simplifies a bit the loop and prevents toolchain
from complaining when directive -Werror=unsafe-loop-optimizations
is enabled.
Issue reported by the Buildroot cross toolchain [1] with the
following error traces:
build/armv7/build/optee-test-3.4.0/host/xtest/regression_4100.c:447:8: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
while (spos) {
^
build/optee-test-3.4.0/host/xtest/regression_4100.c:454:6: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
if (!spos)
^
[1] arm-buildroot-linux-uclibcgnueabihf-gcc.br_real (Buildroot 2019.02-git-00933-gb75e93c) 7.4.0
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
host/xtest/regression_4100.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/host/xtest/regression_4100.c b/host/xtest/regression_4100.c
index b477f38..88346d4 100644
--- a/host/xtest/regression_4100.c
+++ b/host/xtest/regression_4100.c
@@ -445,21 +445,24 @@ static TEEC_Result convert_from_string(ADBG_Case_t *c, TEEC_Session *s,
return TEEC_ERROR_OUT_OF_MEMORY;
while (spos) {
- spos--;
- nibble = digit_value(str[spos]);
- if (nibble == -1)
+ nibble = digit_value(str[spos - 1]);
+ if (nibble == -1) {
+ spos--;
break;
+ }
os[ospos] = nibble;
- if (!spos)
- break;
+ if (spos > 1) {
+ nibble = digit_value(str[spos - 2]);
+ if (nibble == -1) {
+ spos -= 2;
+ break;
+ }
+ os[ospos] |= nibble << 4;
+ ospos--;
+ spos--;
+ }
spos--;
- nibble = digit_value(str[spos]);
- if (nibble == -1)
- break;
-
- os[ospos] |= nibble << 4;
- ospos--;
}
if (spos)
--
2.20.1