Files
twx-linux/include/linux
Jann Horn 5d60a06610 linux/kernel.h: Use parentheses around argument in u64_to_user_ptr()
[ Upstream commit a0fe2c6479 ]

Use parentheses around uses of the argument in u64_to_user_ptr() to
ensure that the cast doesn't apply to part of the argument.

There are existing uses of the macro of the form

  u64_to_user_ptr(A + B)

which expands to

  (void __user *)(uintptr_t)A + B

(the cast applies to the first operand of the addition, the addition
is a pointer addition). This happens to still work as intended, the
semantic difference doesn't cause a difference in behavior.

But I want to use u64_to_user_ptr() with a ternary operator in the
argument, like so:

  u64_to_user_ptr(A ? B : C)

This currently doesn't work as intended.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cc: Andrei Vagin <avagin@openvz.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: NeilBrown <neilb@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Qiaowei Ren <qiaowei.ren@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190329214652.258477-1-jannh@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-05-10 17:53:10 +02:00
..
2019-04-17 08:37:48 +02:00
2019-04-20 09:15:10 +02:00
2018-04-24 09:36:39 +02:00
2018-02-22 15:42:23 +01:00
2018-08-03 07:50:38 +02:00
2019-03-23 14:35:28 +01:00
2018-02-22 15:42:23 +01:00
2018-06-21 04:02:49 +09:00
2018-02-22 15:42:24 +01:00
2019-05-04 09:15:17 +02:00
2018-02-22 15:42:23 +01:00
2017-09-25 08:56:05 -06:00
2018-09-09 19:55:54 +02:00
2019-04-17 08:37:44 +02:00
2018-11-13 11:15:11 -08:00