trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject git commit: TS-1892: fix pagesize integer truncation bug
Date Mon, 13 May 2013 23:27:08 GMT
Updated Branches:
  refs/heads/master bc910ecea -> 5aebfb628


TS-1892: fix pagesize integer truncation bug


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5aebfb62
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5aebfb62
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5aebfb62

Branch: refs/heads/master
Commit: 5aebfb6281d9da3505e3b8e653ef499470f9f685
Parents: bc910ec
Author: James Peach <jpeach@apache.org>
Authored: Mon May 13 16:26:39 2013 -0700
Committer: James Peach <jpeach@apache.org>
Committed: Mon May 13 16:26:39 2013 -0700

----------------------------------------------------------------------
 lib/ts/ink_memory.cc |    6 +++---
 lib/ts/ink_memory.h  |    8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5aebfb62/lib/ts/ink_memory.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_memory.cc b/lib/ts/ink_memory.cc
index 600c24d..64a6b6b 100644
--- a/lib/ts/ink_memory.cc
+++ b/lib/ts/ink_memory.cc
@@ -163,7 +163,7 @@ ats_mallopt(int param ATS_UNUSED, int value ATS_UNUSED)
 int
 ats_msync(caddr_t addr, size_t len, caddr_t end, int flags)
 {
-  unsigned pagesize = ats_pagesize();
+  size_t pagesize = ats_pagesize();
 
   // align start back to page boundary
   caddr_t a = (caddr_t) (((uintptr_t) addr) & ~(pagesize - 1));
@@ -196,7 +196,7 @@ ats_madvise(caddr_t addr, size_t len, int flags)
   (void) flags;
   return 0;
 #else
-  unsigned pagesize = ats_pagesize();
+  size_t pagesize = ats_pagesize();
   caddr_t a = (caddr_t) (((uintptr_t) addr) & ~(pagesize - 1));
   size_t l = (len + (addr - a) + pagesize - 1) & ~(pagesize - 1);
   int res = 0;
@@ -208,7 +208,7 @@ ats_madvise(caddr_t addr, size_t len, int flags)
 int
 ats_mlock(caddr_t addr, size_t len)
 {
-  unsigned pagesize = ats_pagesize();
+  size_t pagesize = ats_pagesize();
 
   caddr_t a = (caddr_t) (((uintptr_t) addr) & ~(pagesize - 1));
   size_t l = (len + (addr - a) + pagesize - 1) & ~(pagesize - 1);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5aebfb62/lib/ts/ink_memory.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_memory.h b/lib/ts/ink_memory.h
index c612dd1..89462de 100644
--- a/lib/ts/ink_memory.h
+++ b/lib/ts/ink_memory.h
@@ -88,13 +88,13 @@ extern "C" {
   int     ats_madvise(caddr_t addr, size_t len, int flags);
   int     ats_mlock(caddr_t addr, size_t len);
 
-  static inline unsigned ats_pagesize(void) {
+  static inline size_t ats_pagesize(void) {
 #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
-    return (unsigned)sysconf(_SC_PAGESIZE);
+    return (size_t)sysconf(_SC_PAGESIZE);
 #elif defined(HAVE_GETPAGESIZE)
-    return (unsigned)getpagesize()
+    return (size_t)getpagesize()
 #else
-    return 8192u;
+    return (size_t)8192;
 #endif
   }
 


Mime
View raw message