From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>, Dan Williams <dan.j.williams@intel.com>,
alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 3.18 42/59] mm: Handle 0 flags in _calc_vm_trans() macro
Date: Thu, 7 Dec 2017 15:51:33 +0000 [thread overview]
Message-ID: <20171207155116.6013-42-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171207155116.6013-1-alexander.levin@verizon.com>
From: Jan Kara <jack@suse.cz>
[ Upstream commit 592e254502041f953e84d091eae2c68cba04c10b ]
_calc_vm_trans() does not handle the situation when some of the passed
flags are 0 (which can happen if these VM flags do not make sense for
the architecture). Improve the _calc_vm_trans() macro to return 0 in
such situation. Since all passed flags are constant, this does not add
any runtime overhead.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
include/linux/mman.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 16373c8f5f57..369bc3405a6d 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -63,8 +63,9 @@ static inline int arch_validate_prot(unsigned long prot)
* ("bit1" and "bit2" must be single bits)
*/
#define _calc_vm_trans(x, bit1, bit2) \
+ ((!(bit1) || !(bit2)) ? 0 : \
((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \
- : ((x) & (bit1)) / ((bit1) / (bit2)))
+ : ((x) & (bit1)) / ((bit1) / (bit2))))
/*
* Combine the mmap "prot" argument into "vm_flags" used internally.
--
2.11.0
next prev parent reply other threads:[~2017-12-07 16:19 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 15:51 [PATCH AUTOSEL for 3.18 01/59] usb: phy: isp1301: Add OF device ID table alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 02/59] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 06/59] NFSD: fix nfsd_reset_versions for NFSv4 alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 05/59] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL) alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 03/59] net: bcmgenet: correct MIB access of UniMAC RUNT counters alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 04/59] net: bcmgenet: Power up the internal PHY before probing the MII alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 07/59] Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 08/59] net: wimax/i2400m: fix NULL-deref at probe alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 10/59] net: Resend IGMP memberships upon peer notification alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 09/59] dmaengine: Fix array index out of bounds warning in __get_unmap_pool() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 13/59] sched/deadline: Use deadline instead of period when calculating overflow alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 12/59] drm/radeon/si: add dpm quirk for Oland alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 14/59] drm/radeon: reinstate oland workaround for sclk alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 11/59] openrisc: fix issue handling 8 byte get_user calls alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 15/59] afs: Fix missing put_page() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 16/59] afs: Populate group ID from vnode status alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 17/59] afs: Adjust mode bits processing alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 19/59] afs: Fix the maths in afs_fs_store_data() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 20/59] afs: Populate and use client modification time alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 21/59] afs: Fix page leak in afs_write_begin() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 18/59] afs: Flush outstanding writes when an fd is closed alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 24/59] NFSv4.1 respect server's max size in CREATE_SESSION alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 22/59] afs: Fix afs_kill_pages() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 25/59] btrfs: add missing memset while reading compressed inline extents alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 23/59] perf symbols: Fix symbols__fixup_end heuristic for corner cases alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 26/59] target: Use system workqueue for ALUA transitions alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 29/59] video: fbdev: au1200fb: Release some resources if a memory allocation fails alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 28/59] video: udlfb: Fix read EDID timeout alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 27/59] fbdev: controlfb: Add missing modes to fix out of bounds access alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 31/59] ASoC: cs42l56: Fix reset GPIO name in example DT binding alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 30/59] video: fbdev: au1200fb: Return an error code if a memory allocation fails alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 33/59] powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 32/59] PCI/PME: Handle invalid data when reading Root Status alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 34/59] powerpc/opal: Fix EBUSY bug in acquiring tokens alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 36/59] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 35/59] powerpc/ipic: Fix status get and status clear alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 37/59] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 41/59] arm-ccn: perf: Prevent module unload while PMU is in use alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 39/59] target:fix condition return in core_pr_dump_initiator_port() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 40/59] target/file: Do not return error for UNMAP if length is zero alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 38/59] iscsi-target: fix memory leak in lio_target_tiqn_addtpg() alexander.levin
2017-12-07 15:51 ` alexander.levin [this message]
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 45/59] thermal/drivers/step_wise: Fix temperature regulation misbehavior alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 44/59] ppp: Destroy the mutex when cleanup alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 43/59] clk: tegra: Fix cclk_lp divisor register alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 46/59] GFS2: Take inode off order_write list when setting jdata flag alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 47/59] bcache: explicitly destroy mutex while exiting alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 49/59] xfs: fix log block underflow during recovery cycle verification alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 51/59] tty fix oops when rmmod 8250 alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 52/59] pinctrl: adi2: Fix Kconfig build problem alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 50/59] PCI: Detach driver before procfs & sysfs teardown on device remove alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 54/59] scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 53/59] raid5: Set R5_Expanded on parity devices as well as data alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 56/59] scsi: bfa: integer overflow in debugfs alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 55/59] ASoC: samsung: i2s: disable secondary DAI until it gets fixed alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 58/59] macvlan: Only deliver one copy of the frame to the macvlan interface alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 59/59] ath9k: fix tx99 potential info leak alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 57/59] udf: Avoid overflow when session starts at large offset alexander.levin
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=20171207155116.6013-42-alexander.levin@verizon.com \
--to=alexander.levin@verizon.com \
--cc=dan.j.williams@intel.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®