All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20180829213311.GA13501@castle>

diff --git a/a/1.txt b/N1/1.txt
index cac3d4d..4c3673c 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -48,3 +48,35 @@ So, below is the patch for the new DIV64_U64_ROUND_UP macro only.
 Thanks!
 
 --
+
+From d8237d3df222e6c5a98a74baa04bc52edf8a3677 Mon Sep 17 00:00:00 2001
+From: Roman Gushchin <guro@fb.com>
+Date: Wed, 29 Aug 2018 14:14:48 -0700
+Subject: [PATCH] math64: prevent double calculation of DIV64_U64_ROUND_UP()
+ arguments
+
+Cause the DIV64_U64_ROUND_UP(ll, d) macro to cache
+the result of (d) expression in a local variable to
+avoid double calculation, which might bring unexpected
+side effects.
+
+Signed-off-by: Roman Gushchin <guro@fb.com>
+---
+ include/linux/math64.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/linux/math64.h b/include/linux/math64.h
+index 94af3d9c73e7..bb2c84afb80c 100644
+--- a/include/linux/math64.h
++++ b/include/linux/math64.h
+@@ -281,6 +281,7 @@ static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor)
+ }
+ #endif /* mul_u64_u32_div */
+ 
+-#define DIV64_U64_ROUND_UP(ll, d)	div64_u64((ll) + (d) - 1, (d))
++#define DIV64_U64_ROUND_UP(ll, d)	\
++	({ u64 _tmp = (d); div64_u64((ll) + _tmp - 1, _tmp); })
+ 
+ #endif /* _LINUX_MATH64_H */
+-- 
+2.17.1
diff --git a/a/content_digest b/N1/content_digest
index 276ca8f..2892545 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -5,9 +5,9 @@
  "Subject\0Re: [PATCH v3 3/3] mm: don't miss the last page because of round-off error\0"
  "Date\0Wed, 29 Aug 2018 14:33:19 -0700\0"
  "To\0Andrew Morton <akpm@linux-foundation.org>\0"
- "Cc\0linux-mm@kvack.org"
-  linux-kernel@vger.kernel.org
-  kernel-team@fb.com
+ "Cc\0<linux-mm@kvack.org>"
+  <linux-kernel@vger.kernel.org>
+  <kernel-team@fb.com>
   Shakeel Butt <shakeelb@google.com>
   Michal Hocko <mhocko@kernel.org>
   Johannes Weiner <hannes@cmpxchg.org>
@@ -66,6 +66,38 @@
  "\n"
  "Thanks!\n"
  "\n"
- --
+ "--\n"
+ "\n"
+ "From d8237d3df222e6c5a98a74baa04bc52edf8a3677 Mon Sep 17 00:00:00 2001\n"
+ "From: Roman Gushchin <guro@fb.com>\n"
+ "Date: Wed, 29 Aug 2018 14:14:48 -0700\n"
+ "Subject: [PATCH] math64: prevent double calculation of DIV64_U64_ROUND_UP()\n"
+ " arguments\n"
+ "\n"
+ "Cause the DIV64_U64_ROUND_UP(ll, d) macro to cache\n"
+ "the result of (d) expression in a local variable to\n"
+ "avoid double calculation, which might bring unexpected\n"
+ "side effects.\n"
+ "\n"
+ "Signed-off-by: Roman Gushchin <guro@fb.com>\n"
+ "---\n"
+ " include/linux/math64.h | 3 ++-\n"
+ " 1 file changed, 2 insertions(+), 1 deletion(-)\n"
+ "\n"
+ "diff --git a/include/linux/math64.h b/include/linux/math64.h\n"
+ "index 94af3d9c73e7..bb2c84afb80c 100644\n"
+ "--- a/include/linux/math64.h\n"
+ "+++ b/include/linux/math64.h\n"
+ "@@ -281,6 +281,7 @@ static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor)\n"
+ " }\n"
+ " #endif /* mul_u64_u32_div */\n"
+ " \n"
+ "-#define DIV64_U64_ROUND_UP(ll, d)\tdiv64_u64((ll) + (d) - 1, (d))\n"
+ "+#define DIV64_U64_ROUND_UP(ll, d)\t\\\n"
+ "+\t({ u64 _tmp = (d); div64_u64((ll) + _tmp - 1, _tmp); })\n"
+ " \n"
+ " #endif /* _LINUX_MATH64_H */\n"
+ "-- \n"
+ 2.17.1
 
-de541a914fa9c03d6faf6ae0446be62bd6ff2ff21d4eaf2bd520120611e55a67
+f56120dff17be3fa24658ad656310ae534ec2436303d0bdbfa94c8911e335f99

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.