Revision cbc543c59e8e7c8bc8604d6ac3e18a029e3d5118 authored by Dave Airlie on 20 October 2022, 23:56:07 UTC, committed by Dave Airlie on 20 October 2022, 23:56:14 UTC
drm-misc-fixes for v6.1-rc2:
- Fix a buffer overflow in format_helper_test.
- Set DDC pointer in drmm_connector_init.
- Compiler fixes for panfrost.

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c4d05683-8ebe-93b8-d24c-d1d2c68f12c4@linux.intel.com
2 parent s a4294d5 + 72655fb
Raw File
io-mapping.c
// SPDX-License-Identifier: GPL-2.0-only

#include <linux/mm.h>
#include <linux/io-mapping.h>

/**
 * io_mapping_map_user - remap an I/O mapping to userspace
 * @iomap: the source io_mapping
 * @vma: user vma to map to
 * @addr: target user address to start at
 * @pfn: physical address of kernel memory
 * @size: size of map area
 *
 *  Note: this is only safe if the mm semaphore is held when called.
 */
int io_mapping_map_user(struct io_mapping *iomap, struct vm_area_struct *vma,
		unsigned long addr, unsigned long pfn, unsigned long size)
{
	vm_flags_t expected_flags = VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;

	if (WARN_ON_ONCE((vma->vm_flags & expected_flags) != expected_flags))
		return -EINVAL;

	/* We rely on prevalidation of the io-mapping to skip track_pfn(). */
	return remap_pfn_range_notrack(vma, addr, pfn, size,
		__pgprot((pgprot_val(iomap->prot) & _PAGE_CACHE_MASK) |
			 (pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK)));
}
EXPORT_SYMBOL_GPL(io_mapping_map_user);
back to top