arm-trusted-firmware/lib
dp-arm afc03aebd3 stdlib: Fix signedness issue in memcmp()
There is no guarantee on the signedness of char.  It can be either
signed or unsigned.  On ARM it is unsigned and hence this memcmp()
implementation works as intended.

On other machines, char can be signed (x86 for example).  In that case
(and assuming a 2's complement implementation), interpreting a
bit-pattern of 0xFF as signed char can yield -1.  If *s1 is 0 and *s2
is 255 then the difference *s1 - *s2 should be negative.  The C
integer promotion rules guarantee that the unsigned chars will be
converted to int before the operation takes place.  The current
implementation will return a positive value (0 - (-1)) instead, which
is wrong.

Fix it by changing the signedness to unsigned to avoid surprises for
anyone using this code on non-ARM systems.

Change-Id: Ie222fcaa7c0c4272d7a521a6f2f51995fd5130cc
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2016-12-13 11:16:31 +00:00
..
aarch32 AArch32: Add `memcpy4` function in assembly 2016-09-28 14:03:47 +01:00
aarch64 Refactor the xlat_tables library code 2016-04-13 12:06:23 +01:00
cpus AArch32: Add support for ARM Cortex-A32 MPCore Processor 2016-09-21 16:28:55 +01:00
el3_runtime Reset EL2 and EL3 configurable controls 2016-12-01 16:17:39 +00:00
libfdt Minor libfdt changes to enable TF integration 2016-06-03 14:21:03 +01:00
locks Fix normal memory bakery lock implementation 2016-11-21 17:10:26 +00:00
pmf Add Performance Measurement Framework(PMF) 2016-06-16 08:31:42 +01:00
psci Add PMF instrumentation points in TF 2016-10-12 15:36:49 +01:00
semihosting AArch32: Common changes needed for BL1/BL2 2016-09-21 16:27:15 +01:00
stdlib stdlib: Fix signedness issue in memcmp() 2016-12-13 11:16:31 +00:00
xlat_tables Automatically select initial xlation lookup level 2016-08-23 10:51:44 +01:00