From: Markos Chandras <Markos.Chandras@imgtec.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH 08/21] syscalls/remap_file_pages: unsigned int is always greater to zero
Date: Tue, 3 Jan 2012 11:04:38 +0000 [thread overview]
Message-ID: <4F02E0C6.3090308@imgtec.com> (raw)
[-- 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
next reply other threads:[~2012-01-03 11:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-03 11:04 Markos Chandras [this message]
2012-01-03 19:37 ` [LTP] [PATCH 08/21] syscalls/remap_file_pages: unsigned int is always greater to zero 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F02E0C6.3090308@imgtec.com \
--to=markos.chandras@imgtec.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox