Skip to contentSkip to conversation

madvise03 address issue

PATCH New lina.zhao 1 participant 1 message Sep 20, 2010

lore
Share & tools
lore

lina.zhao

author
#0 lore raw

PATCH 1/1 madvise03 address issue

Hi,

In the ltp madvise03 case, it will allocate a share memory whose size is equal to the max share memory value.
The max share memory value can be changed to a bigger one through change /proc/sys/kernel/shmmax.
then the 0x22000000 is not a invalid address.
So change the address to NULL to let the system choose a valid address.

Thanks,

Lina

From adbdd3f74ab425a654523234ca24034d40468519 Mon Sep 17 00:00:00 2001
From: Lina Zhao <[email protected]>
Date: Mon, 20 Sep 2010 15:41:42 +0800
Subject: [PATCH] madvise03 address issue

In the ltp madvise03 case, it will allocate a share memory whose size is equal to the max share memory value.
The max share memory value can be changed to a bigger one through change /proc/sys/kernel/shmmax.
then the 0x22000000 is not a invalid address.
So change the address to NULL to let the system choose a valid address.

---
 testcases/kernel/syscalls/madvise/madvise03.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/madvise/madvise03.c +3 -3
index 2527865..269f292 100644
@@ -203,14 +203,14 @@ int main(int argc, char *argv[])
 			tst_brkm(TBROK, cleanup, "shmget error");
 		}
 
-		/* Attach shared memory segment to 0x22000000 address */
+		/* Attach shared memory segment to random address */
 		if ((addr1 =
-		     shmat(shmid1, (void *)0x22000000, 0)) == (void *)-1) {
+		     shmat(shmid1, NULL, 0)) == (void *)-1) {
 			tst_brkm(TBROK, cleanup, "shmat error");
 		}
 
 		/*(1) Test case for MADV_REMOVE */
-		TEST(madvise((void *)0x22000000, 4096, MADV_REMOVE));
+		TEST(madvise((void *)addr1, 4096, MADV_REMOVE));
 		check_and_print("MADV_REMOVE");
 
 		/*(2) Test case for MADV_DONTFORK */
Signature · 1 line
1.6.3.1

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list