lkml.org 
[lkml]   [2013]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RESEND PATCH] x86: add phys addr validity check for /dev/mem mmap
On 10/02/2013 09:05 AM, Frantisek Hrbata wrote:
> +
> +int valid_phys_addr_range(phys_addr_t addr, size_t count)
> +{
> + return addr + count <= __pa(high_memory);
> +}
> +
> +int valid_mmap_phys_addr_range(unsigned long pfn, size_t count)
> +{
> + resource_size_t addr = (pfn << PAGE_SHIFT) + count;
> + return phys_addr_valid(addr);
> +}
>

The latter has overflow problems.

The former I realize matches the current /dev/mem, but it is still just
plain wrong in multiple ways.

-hpa



\
 
 \ /
  Last update: 2013-10-02 23:21    [W:0.071 / U:22.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site