Skip to content

Commit

Permalink
kernel/sys.c: compat sysinfo syscall: fix undefined behavior
Browse files Browse the repository at this point in the history
Fix undefined behavior and compiler warning by replacing right shift 32
with upper_32_bits macro

Signed-off-by: Scotty Bauer <[email protected]>
Cc: Clemens Ladisch <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Scotty Bauer authored and torvalds committed Oct 10, 2014
1 parent ec94fc3 commit 0baae41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,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) {
Expand Down

0 comments on commit 0baae41

Please sign in to comment.