mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 019/118] vm: convert mtdchar mmap to vm_iomap_memory() helper
Date: Tue,  7 May 2013 14:37:45 +0100	[thread overview]
Message-ID: <1367933964-1564-20-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1367933964-1564-1-git-send-email-luis.henriques@canonical.com>

3.5.7.12 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Linus Torvalds <torvalds@linux-foundation.org>

commit 8558e4a26b00225efeb085725bc319f91201b239 upstream.

This is my example conversion of a few existing mmap users.  The mtdchar
case is actually disabled right now (and stays disabled), but I did it
because it showed up on my "git grep", and I was familiar with the code
due to fixing an overflow problem in the code in commit 9c603e53d380
("mtdchar: fix offset overflow detection").

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ luis: adjust context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mtd/mtdchar.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 2cfb1a8..9e33653 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -1132,36 +1132,17 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
 	struct mtd_file_info *mfi = file->private_data;
 	struct mtd_info *mtd = mfi->mtd;
 	struct map_info *map = mtd->priv;
-	unsigned long start;
-	unsigned long off;
-	u32 len;
 
         /* This is broken because it assumes the MTD device is map-based
 	   and that mtd->priv is a valid struct map_info.  It should be
 	   replaced with something that uses the mtd_get_unmapped_area()
 	   operation properly. */
 	if (0 /*mtd->type == MTD_RAM || mtd->type == MTD_ROM*/) {
-		off = vma->vm_pgoff << PAGE_SHIFT;
-		start = map->phys;
-		len = PAGE_ALIGN((start & ~PAGE_MASK) + map->size);
-		start &= PAGE_MASK;
-		if ((vma->vm_end - vma->vm_start + off) > len)
-			return -EINVAL;
-
-		off += start;
-		vma->vm_pgoff = off >> PAGE_SHIFT;
-		vma->vm_flags |= VM_IO | VM_RESERVED;
-
 #ifdef pgprot_noncached
-		if (file->f_flags & O_DSYNC || off >= __pa(high_memory))
+		if (file->f_flags & O_DSYNC || map->phys >= __pa(high_memory))
 			vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 #endif
-		if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
-				       vma->vm_end - vma->vm_start,
-				       vma->vm_page_prot))
-			return -EAGAIN;
-
-		return 0;
+		return vm_iomap_memory(vma, map->phys, map->size);
 	}
 	return -ENOSYS;
 #else
-- 
1.8.1.2


  parent reply	other threads:[~2013-05-07 14:23 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07 13:37 [ 3.5.y.z extended stable ] Linux 3.5.7.12 stable review Luis Henriques
2013-05-07 13:37 ` [PATCH 001/118] ath9k_htc: accept 1.x firmware newer than 1.3 Luis Henriques
2013-05-07 13:37 ` [PATCH 002/118] ssb: implement spurious tone avoidance Luis Henriques
2013-05-07 13:37 ` [PATCH 003/118] can: mcp251x: add missing IRQF_ONESHOT to request_threaded_irq Luis Henriques
2013-05-07 13:37 ` [PATCH 004/118] can: sja1000: fix handling on dt properties on little endian systems Luis Henriques
2013-05-07 13:37 ` [PATCH 005/118] ath9k_hw: change AR9580 initvals to fix a stability issue Luis Henriques
2013-05-07 13:37 ` [PATCH 006/118] ARM: 7696/1: Fix kexec by setting outer_cache.inv_all for Feroceon Luis Henriques
2013-05-07 13:37 ` [PATCH 007/118] ARM: 7698/1: perf: fix group validation when using enable_on_exec Luis Henriques
2013-05-07 13:37 ` [PATCH 008/118] hugetlbfs: add swap entry check in follow_hugetlb_page() Luis Henriques
2013-05-07 13:37 ` [PATCH 009/118] kernel/signal.c: stop info leak via the tkill and the tgkill syscalls Luis Henriques
2013-05-07 13:37 ` [PATCH 010/118] hfsplus: fix potential overflow in hfsplus_file_truncate() Luis Henriques
2013-05-07 13:37 ` [PATCH 011/118] sched: Convert BUG_ON()s in try_to_wake_up_local() to WARN_ON_ONCE()s Luis Henriques
2013-05-07 13:37 ` [PATCH 012/118] crypto: algif - suppress sending source address information in recvmsg Luis Henriques
2013-05-07 13:37 ` [PATCH 013/118] perf: Treat attr.config as u64 in perf_swevent_init() Luis Henriques
2013-05-07 13:37 ` [PATCH 014/118] perf/x86: Fix offcore_rsp valid mask for SNB/IVB Luis Henriques
2013-05-07 13:37 ` [PATCH 015/118] vm: add vm_iomap_memory() helper function Luis Henriques
2013-05-07 13:37 ` [PATCH 016/118] vm: convert HPET mmap to vm_iomap_memory() helper Luis Henriques
2013-05-07 13:37 ` [PATCH 017/118] vm: convert fb_mmap " Luis Henriques
2013-05-07 13:37 ` [PATCH 018/118] vm: convert snd_pcm_lib_mmap_iomem() " Luis Henriques
2013-05-07 13:37 ` Luis Henriques [this message]
2013-05-07 13:37 ` [PATCH 020/118] regulator: fixed regulator_bulk_enable unwinding code Luis Henriques
2013-05-07 13:37 ` [PATCH 021/118] perf: Fix error return code Luis Henriques
2013-05-07 13:37 ` [PATCH 022/118] xen/smp: Fix leakage of timer interrupt line for every CPU online/offline Luis Henriques
2013-05-07 13:37 ` [PATCH 023/118] xen/smp/spinlock: Fix leakage of the spinlock " Luis Henriques
2013-05-07 13:37 ` [PATCH 024/118] xen/time: Fix kasprintf splat when allocating timer%d IRQ line Luis Henriques
2013-05-07 13:37 ` [PATCH 025/118] s390/memory hotplug: prevent offline of active memory increments Luis Henriques
2013-05-07 13:37 ` [PATCH 026/118] aio: fix possible invalid memory access when DEBUG is enabled Luis Henriques
2013-05-07 13:37 ` [PATCH 027/118] TTY: do not update atime/mtime on read/write Luis Henriques
2013-05-07 13:37 ` [PATCH 028/118] TTY: fix atime/mtime regression Luis Henriques
2013-05-07 13:37 ` [PATCH 029/118] atm: update msg_namelen in vcc_recvmsg() Luis Henriques
2013-05-07 13:37 ` [PATCH 030/118] ax25: fix info leak via msg_name in ax25_recvmsg() Luis Henriques
2013-05-07 13:37 ` [PATCH 031/118] Bluetooth: fix possible info leak in bt_sock_recvmsg() Luis Henriques
2013-05-07 13:37 ` [PATCH 032/118] Bluetooth: RFCOMM - Fix missing msg_namelen update in rfcomm_sock_recvmsg() Luis Henriques
2013-05-07 13:37 ` [PATCH 033/118] caif: Fix missing msg_namelen update in caif_seqpkt_recvmsg() Luis Henriques
2013-05-07 13:38 ` [PATCH 034/118] irda: Fix missing msg_namelen update in irda_recvmsg_dgram() Luis Henriques
2013-05-07 13:38 ` [PATCH 035/118] iucv: Fix missing msg_namelen update in iucv_sock_recvmsg() Luis Henriques
2013-05-07 13:38 ` [PATCH 036/118] llc: Fix missing msg_namelen update in llc_ui_recvmsg() Luis Henriques
2013-05-07 13:38 ` [PATCH 037/118] netrom: fix info leak via msg_name in nr_recvmsg() Luis Henriques
2013-05-07 13:38 ` [PATCH 038/118] netrom: fix invalid use of sizeof " Luis Henriques
2013-05-07 13:38 ` [PATCH 039/118] NFC: llcp: fix info leaks via msg_name in llcp_sock_recvmsg() Luis Henriques
2013-05-07 13:38 ` [PATCH 040/118] rose: fix info leak via msg_name in rose_recvmsg() Luis Henriques
2013-05-07 13:38 ` [PATCH 041/118] tipc: fix info leaks via msg_name in recv_msg/recv_stream Luis Henriques
2013-05-07 13:38 ` [PATCH 042/118] cbq: incorrect processing of high limits Luis Henriques
2013-05-07 13:38 ` [PATCH 043/118] net IPv6 : Fix broken IPv6 routing table after loopback down-up Luis Henriques
2013-05-07 13:38 ` [PATCH 044/118] net: count hw_addr syncs so that unsync works properly Luis Henriques
2013-05-07 13:38 ` [PATCH 045/118] atl1e: limit gso segment size to prevent generation of wrong ip length fields Luis Henriques
2013-05-07 13:38 ` [PATCH 046/118] bonding: fix bonding_masters race condition in bond unloading Luis Henriques
2013-05-07 13:38 ` [PATCH 047/118] bonding: IFF_BONDING is not stripped on enslave failure Luis Henriques
2013-05-07 13:38 ` [PATCH 048/118] af_unix: If we don't care about credentials coallesce all messages Luis Henriques
2013-05-07 13:38 ` [PATCH 049/118] netfilter: don't reset nf_trace in nf_reset() Luis Henriques
2013-05-07 13:38 ` [PATCH 050/118] rtnetlink: Call nlmsg_parse() with correct header length Luis Henriques
2013-05-07 13:38 ` [PATCH 051/118] tcp: incoming connections might use wrong route under synflood Luis Henriques
2013-05-07 13:38 ` [PATCH 052/118] tcp: Reallocate headroom if it would overflow csum_start Luis Henriques
2013-05-07 13:38 ` [PATCH 053/118] esp4: fix error return code in esp_output() Luis Henriques
2013-05-07 13:38 ` [PATCH 054/118] net: sctp: sctp_auth_key_put: use kzfree instead of kfree Luis Henriques
2013-05-07 13:38 ` [PATCH 055/118] tcp: call tcp_replace_ts_recent() from tcp_ack() Luis Henriques
2013-05-07 13:38 ` [PATCH 056/118] net: rate-limit warn-bad-offload splats Luis Henriques
2013-05-07 13:38 ` [PATCH 057/118] net: fix incorrect credentials passing Luis Henriques
2013-05-07 13:38 ` [PATCH 058/118] net: drop dst before queueing fragments Luis Henriques
2013-05-07 13:38 ` [PATCH 059/118] sparc64: Fix race in TLB batch processing Luis Henriques
2013-05-07 13:38 ` [PATCH 060/118] l2tp: fix info leak in l2tp_ip6_recvmsg() Luis Henriques
2013-05-07 13:38 ` [PATCH 061/118] tracing: Use stack of calling function for stack tracer Luis Henriques
2013-05-07 13:38 ` [PATCH 062/118] tracing: Fix stack tracer with fentry use Luis Henriques
2013-05-07 13:38 ` [PATCH 063/118] tracing: Remove most or all of stack tracer stack size from stack_max_size Luis Henriques
2013-05-07 13:38 ` [PATCH 064/118] tracing: Fix ftrace_dump() Luis Henriques
2013-05-07 13:38 ` [PATCH 065/118] Wrong asm register contraints in the futex implementation Luis Henriques
2013-05-07 13:38 ` [PATCH 066/118] Wrong asm register contraints in the kvm implementation Luis Henriques
2013-05-07 13:38 ` [PATCH 067/118] cgroup: fix an off-by-one bug which may trigger BUG_ON() Luis Henriques
2013-05-07 13:38 ` [PATCH 068/118] PCI / ACPI: Don't query OSC support with all possible controls Luis Henriques
2013-05-07 13:38 ` [PATCH 069/118] Fix initialization of CMCI/CMCP interrupts Luis Henriques
2013-05-07 13:38 ` [PATCH 070/118] sysfs: fix use after free in case of concurrent read/write and readdir Luis Henriques
2013-05-07 13:38 ` [PATCH 071/118] usb/misc/appledisplay: Add 24" LED Cinema display Luis Henriques
2013-05-07 13:38 ` [PATCH 072/118] ext4/jbd2: don't wait (forever) for stale tid caused by wraparound Luis Henriques
2013-05-07 13:38 ` [PATCH 073/118] jbd2: fix race between jbd2_journal_remove_checkpoint and ->j_commit_callback Luis Henriques
2013-05-07 13:38 ` [PATCH 074/118] ext4: fix journal callback list traversal Luis Henriques
2013-05-07 13:38 ` [PATCH 075/118] usb: chipidea: udc: fix memory access of shared memory on armv5 machines Luis Henriques
2013-05-07 13:38 ` [PATCH 076/118] NFSv4: Handle NFS4ERR_DELAY and NFS4ERR_GRACE in nfs4_open_delegation_recall Luis Henriques
2013-05-07 13:38 ` [PATCH 077/118] usb: chipidea: udc: fix memory leak in _ep_nuke Luis Henriques
2013-05-07 13:38 ` [PATCH 078/118] USB: add ftdi_sio USB ID for GDM Boost V1.x Luis Henriques
2013-05-07 13:38 ` [PATCH 079/118] hrtimer: Add expiry time overflow check in hrtimer_interrupt Luis Henriques
2013-05-07 13:38 ` [PATCH 080/118] hrtimer: Fix ktime_add_ns() overflow on 32bit architectures Luis Henriques
2013-05-07 13:38 ` [PATCH 081/118] ARM: omap3: cpuidle: enable time keeping Luis Henriques
2013-05-07 13:38 ` [PATCH 082/118] tracing: Fix off-by-one on allocating stat->pages Luis Henriques
2013-05-07 13:38 ` [PATCH 083/118] USB: option: add a D-Link DWM-156 variant Luis Henriques
2013-05-07 13:38 ` [PATCH 084/118] ext4: fix big-endian bug in metadata checksum calculations Luis Henriques
2013-05-07 13:38 ` [PATCH 085/118] tracing: Reset ftrace_graph_filter_enabled if count is zero Luis Henriques
2013-05-07 13:38 ` [PATCH 086/118] tracing: Check return value of tracing_init_dentry() Luis Henriques
2013-05-07 13:38 ` [PATCH 087/118] serial_core.c: add put_device() after device_find_child() Luis Henriques
2013-05-07 13:38 ` [PATCH 088/118] PCI/PM: Fix fallback to PCI_D0 in pci_platform_power_transition() Luis Henriques
2013-05-07 13:38 ` [PATCH 089/118] wireless: regulatory: fix channel disabling race condition Luis Henriques
2013-05-07 13:38 ` [PATCH 090/118] usbfs: Always allow ctrl requests with USB_RECIP_ENDPOINT on the ctrl ep Luis Henriques
2013-05-07 13:38 ` [PATCH 091/118] iwlwifi: fix freeing uninitialized pointer Luis Henriques
2013-05-07 13:38 ` [PATCH 092/118] iwlwifi: dvm: don't send zeroed LQ cmd Luis Henriques
2013-05-07 13:38 ` [PATCH 093/118] LOCKD: Ensure that nlmclnt_block resets block->b_status after a server reboot Luis Henriques
2013-05-07 13:39 ` [PATCH 094/118] ext4: fix online resizing for ext3-compat file systems Luis Henriques
2013-05-07 13:39 ` [PATCH 095/118] ext4: fix Kconfig documentation for CONFIG_EXT4_DEBUG Luis Henriques
2013-05-07 13:39 ` [PATCH 096/118] rt2x00: Fix transmit power troubles on some Ralink RT30xx cards Luis Henriques
2013-05-07 13:39 ` [PATCH 097/118] USB: ftdi_sio: correct ST Micro Connect Lite PIDs Luis Henriques
2013-05-07 13:39 ` [PATCH 098/118] USB: serial: option: Added support Olivetti Olicard 145 Luis Henriques
2013-05-07 13:39 ` [PATCH 099/118] usb-storage: CY7C68300A chips do not support Cypress ATACB Luis Henriques
2013-05-07 13:39 ` [PATCH 100/118] USB: ftdi_sio: enable two UART ports on ST Microconnect Lite Luis Henriques
2013-05-07 13:39 ` [PATCH 101/118] gianfar: do not advertise any alarm capability Luis Henriques
2013-05-07 13:39 ` [PATCH 102/118] clockevents: Set dummy handler on CPU_DEAD shutdown Luis Henriques
2013-05-07 13:39 ` [PATCH 103/118] ixgbe: fix EICR write in ixgbe_msix_other Luis Henriques
2013-05-07 13:39 ` [PATCH 104/118] mwifiex: Use pci_release_region() instead of a pci_release_regions() Luis Henriques
2013-05-07 13:39 ` [PATCH 105/118] mwifiex: Call pci_release_region after calling pci_disable_device Luis Henriques
2013-05-07 13:39 ` [PATCH 106/118] fs/fscache/stats.c: fix memory leak Luis Henriques
2013-05-07 13:39 ` [PATCH 107/118] mm: allow arch code to control the user page table ceiling Luis Henriques
2013-05-07 13:39 ` [PATCH 108/118] arm: set the page table freeing ceiling to TASK_SIZE Luis Henriques
2013-05-07 13:39 ` [PATCH 109/118] drivers/rtc/rtc-cmos.c: don't disable hpet emulation on suspend Luis Henriques
2013-05-07 13:39 ` [PATCH 110/118] drivers/rtc/rtc-at91rm9200.c: fix missing iounmap Luis Henriques
2013-05-07 13:39 ` [PATCH 111/118] md: bad block list should default to disabled Luis Henriques
2013-05-07 13:39 ` [PATCH 112/118] inotify: invalid mask should return a error number but not set it Luis Henriques
2013-05-07 13:39 ` [PATCH 113/118] fs/dcache.c: add cond_resched() to shrink_dcache_parent() Luis Henriques
2013-05-07 13:39 ` [PATCH 114/118] exec: do not abuse ->cred_guard_mutex in threadgroup_lock() Luis Henriques
2013-05-07 13:39 ` [PATCH 115/118] tty: fix up atime/mtime mess, take three Luis Henriques
2013-05-07 13:39 ` [PATCH 116/118] ipc: sysv shared memory limited to 8TiB Luis Henriques
2013-05-07 13:39 ` [PATCH 117/118] Revert "drm/i915: GFX_MODE Flush TLB Invalidate Mode must be '1' for scanline waits" Luis Henriques
2013-05-07 13:39 ` [PATCH 118/118] ARM: 7699/1: sched_clock: Add more notrace to prevent recursion Luis Henriques

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=1367933964-1564-20-git-send-email-luis.henriques@canonical.com \
    --to=luis.henriques@canonical.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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®