linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jann Horn <jannh@google.com>,
	Borislav Petkov <bp@suse.de>, Mukesh Ojha <mojha@codeaurora.org>,
	Andrei Vagin <avagin@openvz.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@kernel.org>,
	Jani Nikula <jani.nikula@intel.com>,
	Kees Cook <keescook@chromium.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	NeilBrown <neilb@suse.com>, Peter Zijlstra <peterz@infradead.org>,
	Qiaowei Ren <qiaowei.ren@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>, x86-ml <x86@kernel.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 31/66] linux/kernel.h: Use parentheses around argument in u64_to_user_ptr()
Date: Thu,  9 May 2019 20:42:06 +0200	[thread overview]
Message-ID: <20190509181305.215780475@linuxfoundation.org> (raw)
In-Reply-To: <20190509181301.719249738@linuxfoundation.org>

[ Upstream commit a0fe2c6479aab5723239b315ef1b552673f434a3 ]

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>
---
 include/linux/kernel.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d6aac75b51baa..3d83ebb302cfd 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -73,8 +73,8 @@
 
 #define u64_to_user_ptr(x) (		\
 {					\
-	typecheck(u64, x);		\
-	(void __user *)(uintptr_t)x;	\
+	typecheck(u64, (x));		\
+	(void __user *)(uintptr_t)(x);	\
 }					\
 )
 
-- 
2.20.1




  parent reply	other threads:[~2019-05-09 19:04 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 18:41 [PATCH 4.19 00/66] 4.19.42-stable review Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 01/66] net: stmmac: Use bfsize1 in ndesc_init_rx_desc Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 02/66] scsi: libsas: fix a race condition when smp task timeout Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 03/66] Drivers: hv: vmbus: Remove the undesired put_cpu_ptr() in hv_synic_cleanup() Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 04/66] ubsan: Fix nasty -Wbuiltin-declaration-mismatch GCC-9 warnings Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 05/66] staging: greybus: power_supply: fix prop-descriptor request size Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 06/66] staging: most: cdev: fix chrdev_region leak in mod_exit Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 07/66] ASoC: tlv320aic3x: fix reset gpio reference counting Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 08/66] ASoC: hdmi-codec: fix S/PDIF DAI Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 09/66] ASoC: stm32: sai: fix iec958 controls indexation Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 10/66] ASoC: stm32: sai: fix exposed capabilities in spdif mode Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 11/66] ASoC:soc-pcm:fix a codec fixup issue in TDM case Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 12/66] ASoC:intel:skl:fix a simultaneous playback & capture issue on hda platform Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 13/66] ASoC: nau8824: fix the issue of the widget with prefix name Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 14/66] ASoC: nau8810: fix the issue of widget with prefixed name Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 15/66] ASoC: samsung: odroid: Fix clock configuration for 44100 sample rate Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 16/66] ASoC: rt5682: recording has no sound after booting Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 17/66] ASoC: wm_adsp: Add locking to wm_adsp2_bus_error Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 18/66] clk: meson-gxbb: round the vdec dividers to closest Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 19/66] ASoC: stm32: dfsdm: manage multiple prepare Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 20/66] ASoC: stm32: dfsdm: fix debugfs warnings on entry creation Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 21/66] ASoC: cs4270: Set auto-increment bit for register writes Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 22/66] ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 23/66] drm/omap: hdmi4_cec: Fix CEC clock handling for PM Greg Kroah-Hartman
2019-05-09 18:41 ` [PATCH 4.19 24/66] IB/hfi1: Eliminate opcode tests on mr deref Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 25/66] IB/hfi1: Fix the allocation of RSM table Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 26/66] MIPS: KGDB: fix kgdb support for SMP platforms Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 27/66] ASoC: tlv320aic32x4: Fix Common Pins Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 28/66] drm/mediatek: Fix an error code in mtk_hdmi_dt_parse_pdata() Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 29/66] perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 30/66] perf/x86/intel: Initialize TFA MSR Greg Kroah-Hartman
2019-05-09 18:42 ` Greg Kroah-Hartman [this message]
2019-05-09 18:42 ` [PATCH 4.19 32/66] xtensa: fix initialization of pt_regs::syscall in start_thread Greg Kroah-Hartman
2019-05-09 18:55   ` Max Filippov
2019-05-10  6:24     ` Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 33/66] ASoC: rockchip: pdm: fix regmap_ops hang issue Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 34/66] drm/amd/display: fix cursor black issue Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 35/66] ASoC: cs35l35: Disable regulators on driver removal Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 36/66] objtool: Add rewind_stack_do_exit() to the noreturn list Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 37/66] slab: fix a crash by reading /proc/slab_allocators Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 38/66] drm/sun4i: tcon top: Fix NULL/invalid pointer dereference in sun8i_tcon_top_un/bind Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 39/66] virtio_pci: fix a NULL pointer reference in vp_del_vqs Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 40/66] RDMA/vmw_pvrdma: Fix memory leak on pvrdma_pci_remove Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 41/66] RDMA/hns: Fix bug that caused srq creation to fail Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 42/66] scsi: csiostor: fix missing data copy in csio_scsi_err_handler() Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 43/66] drm/mediatek: fix possible object reference leak Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 44/66] ASoC: Intel: kbl: fix wrong number of channels Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 45/66] virtio-blk: limit number of hw queues by nr_cpu_ids Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 46/66] nvme-fc: correct csn initialization and increments on error Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 47/66] platform/x86: pmc_atom: Drop __initconst on dmi table Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 48/66] perf/core: Fix perf_event_disable_inatomic() race Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 49/66] iommu/amd: Set exclusion range correctly Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 50/66] genirq: Prevent use-after-free and work list corruption Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 51/66] usb: dwc3: Fix default lpm_nyet_threshold value Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 52/66] USB: serial: f81232: fix interrupt worker not stop Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 53/66] USB: cdc-acm: fix unthrottle races Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 54/66] usb-storage: Set virt_boundary_mask to avoid SG overflows Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 55/66] intel_th: pci: Add Comet Lake support Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 56/66] cpufreq: armada-37xx: fix frequency calculation for opp Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 57/66] soc: sunxi: Fix missing dependency on REGMAP_MMIO Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 58/66] scsi: lpfc: change snprintf to scnprintf for possible overflow Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 59/66] scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 60/66] scsi: qla2xxx: Fix device staying in blocked state Greg Kroah-Hartman
2019-05-09 20:28   ` [EXT] " Quoc Tran
2019-05-10  5:37     ` Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 61/66] Bluetooth: hidp: fix buffer overflow Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 62/66] Bluetooth: Align minimum encryption key size for LE and BR/EDR connections Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 63/66] UAS: fix alignment of scatter/gather segments Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 64/66] ASoC: Intel: avoid Oops if DMA setup fails Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 65/66] locking/futex: Allow low-level atomic operations to return -EAGAIN Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 4.19 66/66] arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP Greg Kroah-Hartman
2019-05-10  0:07 ` [PATCH 4.19 00/66] 4.19.42-stable review kernelci.org bot
2019-05-10  6:34 ` Naresh Kamboju
2019-05-10 10:16 ` Jon Hunter
2019-05-10 13:35 ` Guenter Roeck
2019-05-10 21:25 ` shuah
2019-05-11 11:19 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190509181305.215780475@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@openvz.org \
    --cc=bp@suse.de \
    --cc=dan.carpenter@oracle.com \
    --cc=hpa@zytor.com \
    --cc=jani.nikula@intel.com \
    --cc=jannh@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mojha@codeaurora.org \
    --cc=neilb@suse.com \
    --cc=peterz@infradead.org \
    --cc=qiaowei.ren@intel.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).