public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 08/21] syscalls/remap_file_pages: unsigned int is always greater to zero
@ 2012-01-03 11:04 Markos Chandras
  2012-01-03 19:37 ` Garrett Cooper
  2012-01-03 20:38 ` Mike Frysinger
  0 siblings, 2 replies; 5+ messages in thread
From: Markos Chandras @ 2012-01-03 11:04 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 49 bytes --]

Hi, please review the attached patch

-- 
markos

[-- Attachment #2: 0008-syscalls-remap_file_pages-unsigned-int-is-always-gre.patch --]
[-- Type: text/plain, Size: 2185 bytes --]

From 91f35a787627ef3bfb77dd0f0dc5e8993016b0b5 Mon Sep 17 00:00:00 2001
From: Markos Chandras <markos.chandras@imgtec.com>
Date: Thu, 22 Dec 2011 13:05:58 +0000
Subject: [PATCH 08/21] syscalls/remap_file_pages: unsigned int is always greater to zero

getpagesize() returns an integer value ( which can be negative in case of
an error ). However, when a negative value is assigned to unsigned int, the
result is a much greater integer (2's complement), therefore the expression
page_sz > 0 is always true. A getpagesize() error won't be noticed in this case

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 .../syscalls/remap_file_pages/remap_file_pages01.c |    6 +++---
 .../syscalls/remap_file_pages/remap_file_pages02.c |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c b/testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c
index 01fd291..fa1bdca 100644
--- a/testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c
+++ b/testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c
@@ -231,11 +231,11 @@ void setup()
 	TEST_PAUSE;
 
 	/* Get page size */
-	if ((page_sz = getpagesize()) < 0) {
+	if (getpagesize() < 0) {
 		tst_brkm(TFAIL, cleanup,
 			 "getpagesize() fails to get system page size");
 	}
-
+	page_sz = getpagesize();
 	page_words = (page_sz / sizeof(char));
 
 	/* Set the cache size */
@@ -287,4 +287,4 @@ void cleanup(char *data)
 
 	tst_rmdir();
 
-}
\ No newline at end of file
+}
diff --git a/testcases/kernel/syscalls/remap_file_pages/remap_file_pages02.c b/testcases/kernel/syscalls/remap_file_pages/remap_file_pages02.c
index c30abe8..c70bfe8 100644
--- a/testcases/kernel/syscalls/remap_file_pages/remap_file_pages02.c
+++ b/testcases/kernel/syscalls/remap_file_pages/remap_file_pages02.c
@@ -281,11 +281,11 @@ void setup()
 	tst_tmpdir();
 
 	/* Get page size */
-	if ((page_sz = getpagesize()) < 0) {
+	if (getpagesize() < 0) {
 		tst_brkm(TFAIL, cleanup,
 			 "getpagesize() fails to get system page size");
 	}
-
+	page_sz = getpagesize();
 	page_words = (page_sz / sizeof(char));
 
 	/* Set the cache size */
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 355 bytes --]

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-05 10:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-03 11:04 [LTP] [PATCH 08/21] syscalls/remap_file_pages: unsigned int is always greater to zero Markos Chandras
2012-01-03 19:37 ` Garrett Cooper
2012-01-03 20:38 ` Mike Frysinger
2012-01-04 14:34   ` Cyril Hrubis
     [not found]     ` <201201041358.21225.vapier@gentoo.org>
2012-01-05 10:45       ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox