lkml.org 
[lkml]   [2014]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] kern/sys: Compat sysinfo syscall fix undefined behavior

Fix undefined behavior and compiler warning by replacing right
shift 32 with upper_32_bits macro

Signed-off-by: Scotty Bauer <sbauer@eng.utah.edu>
---
kernel/sys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index ce81291..c78530b 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2135,7 +2135,7 @@ COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
/* Check to see if any memory value is too large for 32-bit and scale
* down if needed
*/
- if ((s.totalram >> 32) || (s.totalswap >> 32)) {
+ if (upper_32_bits(s.totalram) || upper_32_bits(s.totalswap)) {
int bitcount = 0;

while (s.mem_unit < PAGE_SIZE) {
--
1.8.3.2
\
 
 \ /
  Last update: 2014-09-04 21:01    [W:0.035 / U:1.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site