December 29, 2021 12:06 PM, "Jinoh Kang" jinoh.kang.kr@gmail.com wrote:
diff --git a/loader/preloader.c b/loader/preloader.c index 585be50624f..cb20afd4d5a 100644 --- a/loader/preloader.c +++ b/loader/preloader.c @@ -236,7 +236,7 @@ __ASM_GLOBAL_FUNC(_start,
/* wrappers for Linux system calls */
-#define SYSCALL_RET(ret) (((ret) < 0 && (ret) > -4096) ? -1 : (ret)) +#define SYSCALL_RET(ret) (((unsigned long)(ret) > -4096UL) ? -1 : (ret))
This seems wrong. It actually happens to be correct according to the rules of 2's-complement arithmetic (-4096 == 0xFFFFF000, -1 == 0xFFFFFFFF), but that's not obvious looking at the code. I had to work that out to verify this. That doesn't sit well with me, and I suspect it won't sit well with Alexandre, either.
static inline __attribute__((noreturn)) void wld_exit( int code ) {
Chip