Home
last modified time | relevance | path

Searched hist:a4909c0dfb38cdb144f9ec8301365dadc2eee98a (Results 1 – 1 of 1) sorted by relevance

/optee_os/lib/libutils/isoc/
H A Dqsort.ca4909c0dfb38cdb144f9ec8301365dadc2eee98a Fri Dec 10 17:01:34 UTC 2021 Jerome Forissier <jerome@forissier.org> libutils: qsort.c: fix undefined pointer subtraction

Clang 13.0.0 produces the following warning:

lib/libutils/isoc/qsort.c:81:8: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
loop: SWAPINIT(a, es);
^~~~~~~~~~~~~~~
lib/libutils/isoc/qsort.c:50:47: note: expanded from macro 'SWAPINIT'
#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long)
^ ~~~~~~~~~

Replace the subtraction with a simple cast to uintptr_t.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>