Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common When converting limits from linux32 ...



details:   https://anonhg.NetBSD.org/src/rev/cd952067f899
branches:  trunk
changeset: 336406:cd952067f899
user:      njoly <njoly%NetBSD.org@localhost>
date:      Sat Feb 28 13:08:00 2015 +0000

description:
When converting limits from linux32 (int32_t) to native (uint64_t),
cast it to unsigned first to avoid bad side effect for negative
values.

diffstat:

 sys/compat/linux/common/linux_limit.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r e294363dea89 -r cd952067f899 sys/compat/linux/common/linux_limit.h
--- a/sys/compat/linux/common/linux_limit.h     Sat Feb 28 09:34:34 2015 +0000
+++ b/sys/compat/linux/common/linux_limit.h     Sat Feb 28 13:08:00 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_limit.h,v 1.6 2012/09/22 22:34:02 joerg Exp $ */
+/*     $NetBSD: linux_limit.h,v 1.7 2015/02/28 13:08:00 njoly Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
     linux_to_bsd_rlimit1(b, l, rlim_max)
 
 #define linux32_to_bsd_rlimit1(b, l, f) \
-    (b)->f = (l)->f == LINUX32_RLIM_INFINITY ? RLIM_INFINITY : (l)->f
+    (b)->f = (l)->f == LINUX32_RLIM_INFINITY ? RLIM_INFINITY : (uint32_t)(l)->f
 #define linux32_to_bsd_rlimit(b, l) \
     linux32_to_bsd_rlimit1(b, l, rlim_cur); \
     linux32_to_bsd_rlimit1(b, l, rlim_max)



Home | Main Index | Thread Index | Old Index