[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <524C5BFB.5050501@zytor.com>
Date: Wed, 02 Oct 2013 10:46:35 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Frantisek Hrbata <fhrbata@...hat.com>
CC: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
tglx@...utronix.de, mingo@...hat.com, x86@...nel.org,
oleg@...hat.com, kamaleshb@...ibm.com, hechjie@...ibm.com,
akpm@...ux-foundation.org, dave.hansen@...el.com
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists