[LTP] [PATCH 1/2] [COMMITTED] syscalls/shmat01: Fix test on 32bit
Cyril Hrubis
chrubis@suse.cz
Tue Sep 12 17:18:26 CEST 2017
The problem there is that the address casted to intptr_t yields negative
number which when divided then multiplied by SHMLBA aligns the value up
instead of down.
The fix is simple, we cast the pointer to uintptr_t instead of intptr_t
and also include stdint.h explicitly.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
testcases/kernel/syscalls/ipc/shmat/shmat01.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat01.c b/testcases/kernel/syscalls/ipc/shmat/shmat01.c
index 4f5c4e725..4c6ce58d3 100644
--- a/testcases/kernel/syscalls/ipc/shmat/shmat01.c
+++ b/testcases/kernel/syscalls/ipc/shmat/shmat01.c
@@ -35,12 +35,13 @@
#include <sys/shm.h>
#include <sys/wait.h>
#include <stdlib.h>
+#include <stdint.h>
#include "tst_test.h"
#include "tst_safe_sysv_ipc.h"
#include "libnewipc.h"
-#define ALIGN_DOWN(in_addr) ((void *)(((intptr_t)in_addr / SHMLBA) * SHMLBA))
+#define ALIGN_DOWN(in_addr) ((void *)(((uintptr_t)in_addr / SHMLBA) * SHMLBA))
static int shm_id = -1;
static key_t shm_key;
--
2.13.0
More information about the ltp
mailing list