]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Sep 2016 13:21:38 +0000 (15:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Sep 2016 13:21:38 +0000 (15:21 +0200)
added patches:
fix-build-warning-in-kernel-cpuset.c.patch
include-linux-kernel.h-change-abs-macro-so-it-uses-consistent-return-type.patch

queue-4.4/fix-build-warning-in-kernel-cpuset.c.patch [new file with mode: 0644]
queue-4.4/include-linux-kernel.h-change-abs-macro-so-it-uses-consistent-return-type.patch [new file with mode: 0644]
queue-4.4/series [new file with mode: 0644]

diff --git a/queue-4.4/fix-build-warning-in-kernel-cpuset.c.patch b/queue-4.4/fix-build-warning-in-kernel-cpuset.c.patch
new file mode 100644 (file)
index 0000000..40bc54b
--- /dev/null
@@ -0,0 +1,42 @@
+From arnd@arndb.de  Sun Sep 25 15:19:10 2016
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Sat, 24 Sep 2016 23:29:51 +0200
+Subject: Fix build warning in kernel/cpuset.c
+To: linaro-kernel@lists.linaro.org
+Cc: Build bot for Mark Brown <broonie@kernel.org>, kernel-build-reports@lists.linaro.org, stable@vger.kernel.org
+Message-ID: <2634456.rLc29tnUR8@wuerfel>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+
+>           2 ../kernel/cpuset.c:2101:11: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
+>           1 ../kernel/cpuset.c:2101:2: warning: initialization from incompatible pointer type
+>           1 ../kernel/cpuset.c:2101:2: warning: (near initialization for 'cpuset_cgrp_subsys.fork')
+
+This got introduced by 06ec7a1d7646 ("cpuset: make sure new tasks
+conform to the current config of the cpuset"). In the upstream
+kernel, the function prototype was changed as of b53202e63089
+("cgroup: kill cgrp_ss_priv[CGROUP_CANFORK_COUNT] and friends").
+
+That patch is not suitable for stable kernels, and fortunately
+the warning seems harmless as the prototypes only differ in the
+second argument that is unused. Adding that argument gets rid
+of the warning:
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/cpuset.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/cpuset.c
++++ b/kernel/cpuset.c
+@@ -2079,7 +2079,7 @@ static void cpuset_bind(struct cgroup_su
+  * which could have been changed by cpuset just after it inherits the
+  * state from the parent and before it sits on the cgroup's task list.
+  */
+-void cpuset_fork(struct task_struct *task)
++void cpuset_fork(struct task_struct *task, void *priv)
+ {
+       if (task_css_is_root(task, cpuset_cgrp_id))
+               return;
diff --git a/queue-4.4/include-linux-kernel.h-change-abs-macro-so-it-uses-consistent-return-type.patch b/queue-4.4/include-linux-kernel.h-change-abs-macro-so-it-uses-consistent-return-type.patch
new file mode 100644 (file)
index 0000000..d776e61
--- /dev/null
@@ -0,0 +1,146 @@
+From 8f57e4d930d48217268315898212518d4d3e0773 Mon Sep 17 00:00:00 2001
+From: Michal Nazarewicz <mina86@mina86.com>
+Date: Fri, 15 Jan 2016 16:57:58 -0800
+Subject: include/linux/kernel.h: change abs() macro so it uses consistent return type
+
+From: Michal Nazarewicz <mina86@mina86.com>
+
+commit 8f57e4d930d48217268315898212518d4d3e0773 upstream.
+
+Rewrite abs() so that its return type does not depend on the
+architecture and no unexpected type conversion happen inside of it.  The
+only conversion is from unsigned to signed type.  char is left as a
+return type but treated as a signed type regradless of it's actual
+signedness.
+
+With the old version, int arguments were promoted to long and depending
+on architecture a long argument might result in s64 or long return type
+(which may or may not be the same).
+
+This came after some back and forth with Nicolas.  The current macro has
+different return type (for the same input type) depending on
+architecture which might be midly iritating.
+
+An alternative version would promote to int like so:
+
+       #define abs(x)  __abs_choose_expr(x, long long,                 \
+                       __abs_choose_expr(x, long,                      \
+                       __builtin_choose_expr(                          \
+                               sizeof(x) <= sizeof(int),               \
+                               ({ int __x = (x); __x<0?-__x:__x; }),   \
+                               ((void)0))))
+
+I have no preference but imagine Linus might.  :] Nicolas argument against
+is that promoting to int causes iconsistent behaviour:
+
+       int main(void) {
+               unsigned short a = 0, b = 1, c = a - b;
+               unsigned short d = abs(a - b);
+               unsigned short e = abs(c);
+               printf("%u %u\n", d, e);  // prints: 1 65535
+       }
+
+Then again, no sane person expects consistent behaviour from C integer
+arithmetic.  ;)
+
+Note:
+
+  __builtin_types_compatible_p(unsigned char, char) is always false, and
+  __builtin_types_compatible_p(signed char, char) is also always false.
+
+Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
+Reviewed-by: Nicolas Pitre <nico@linaro.org>
+Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
+Cc: Wey-Yi Guy <wey-yi.w.guy@intel.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/iio/industrialio-core.c          |    9 +++----
+ drivers/net/wireless/iwlwifi/dvm/calib.c |    2 -
+ include/linux/kernel.h                   |   36 +++++++++++++++----------------
+ 3 files changed, 23 insertions(+), 24 deletions(-)
+
+--- a/drivers/iio/industrialio-core.c
++++ b/drivers/iio/industrialio-core.c
+@@ -433,16 +433,15 @@ ssize_t iio_format_value(char *buf, unsi
+               scale_db = true;
+       case IIO_VAL_INT_PLUS_MICRO:
+               if (vals[1] < 0)
+-                      return sprintf(buf, "-%ld.%06u%s\n", abs(vals[0]),
+-                                      -vals[1],
+-                              scale_db ? " dB" : "");
++                      return sprintf(buf, "-%d.%06u%s\n", abs(vals[0]),
++                                     -vals[1], scale_db ? " dB" : "");
+               else
+                       return sprintf(buf, "%d.%06u%s\n", vals[0], vals[1],
+                               scale_db ? " dB" : "");
+       case IIO_VAL_INT_PLUS_NANO:
+               if (vals[1] < 0)
+-                      return sprintf(buf, "-%ld.%09u\n", abs(vals[0]),
+-                                      -vals[1]);
++                      return sprintf(buf, "-%d.%09u\n", abs(vals[0]),
++                                     -vals[1]);
+               else
+                       return sprintf(buf, "%d.%09u\n", vals[0], vals[1]);
+       case IIO_VAL_FRACTIONAL:
+--- a/drivers/net/wireless/iwlwifi/dvm/calib.c
++++ b/drivers/net/wireless/iwlwifi/dvm/calib.c
+@@ -901,7 +901,7 @@ static void iwlagn_gain_computation(stru
+               /* bound gain by 2 bits value max, 3rd bit is sign */
+               data->delta_gain_code[i] =
+                       min(abs(delta_g),
+-                      (long) CHAIN_NOISE_MAX_DELTA_GAIN_CODE);
++                      (s32) CHAIN_NOISE_MAX_DELTA_GAIN_CODE);
+               if (delta_g < 0)
+                       /*
+--- a/include/linux/kernel.h
++++ b/include/linux/kernel.h
+@@ -202,26 +202,26 @@ extern int _cond_resched(void);
+ /**
+  * abs - return absolute value of an argument
+- * @x: the value.  If it is unsigned type, it is converted to signed type first
+- *   (s64, long or int depending on its size).
++ * @x: the value.  If it is unsigned type, it is converted to signed type first.
++ *     char is treated as if it was signed (regardless of whether it really is)
++ *     but the macro's return type is preserved as char.
+  *
+- * Return: an absolute value of x.  If x is 64-bit, macro's return type is s64,
+- *   otherwise it is signed long.
++ * Return: an absolute value of x.
+  */
+-#define abs(x) __builtin_choose_expr(sizeof(x) == sizeof(s64), ({     \
+-              s64 __x = (x);                                          \
+-              (__x < 0) ? -__x : __x;                                 \
+-      }), ({                                                          \
+-              long ret;                                               \
+-              if (sizeof(x) == sizeof(long)) {                        \
+-                      long __x = (x);                                 \
+-                      ret = (__x < 0) ? -__x : __x;                   \
+-              } else {                                                \
+-                      int __x = (x);                                  \
+-                      ret = (__x < 0) ? -__x : __x;                   \
+-              }                                                       \
+-              ret;                                                    \
+-      }))
++#define abs(x)        __abs_choose_expr(x, long long,                         \
++              __abs_choose_expr(x, long,                              \
++              __abs_choose_expr(x, int,                               \
++              __abs_choose_expr(x, short,                             \
++              __abs_choose_expr(x, char,                              \
++              __builtin_choose_expr(                                  \
++                      __builtin_types_compatible_p(typeof(x), char),  \
++                      (char)({ signed char __x = (x); __x<0?-__x:__x; }), \
++                      ((void)0)))))))
++
++#define __abs_choose_expr(x, type, other) __builtin_choose_expr(      \
++      __builtin_types_compatible_p(typeof(x),   signed type) ||       \
++      __builtin_types_compatible_p(typeof(x), unsigned type),         \
++      ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
+ /**
+  * reciprocal_scale - "scale" a value into range [0, ep_ro)
diff --git a/queue-4.4/series b/queue-4.4/series
new file mode 100644 (file)
index 0000000..067067c
--- /dev/null
@@ -0,0 +1,2 @@
+include-linux-kernel.h-change-abs-macro-so-it-uses-consistent-return-type.patch
+fix-build-warning-in-kernel-cpuset.c.patch