misc: fix /dev/mem size
The size of /dev/mem was limited to the lower half of the 64bit address
range. This is unfortunate since on some architectures (MIPS64, namely)
the upper half contains meaningful addresses. We can't just set /dev/mem
to its real size since that's bigger than the maximum loff_t. Set the
DEVFS_IS_CHARACTER_DEV flag instead for /dev/mem which will cause the
size checks in lseek and friends to be bypassed.
Also fix the size the memory device is registered with. We used to set
the size to ~0, but the real size is one higher. To do this explicitly
register the device with specifying the end address rather than the
size. This will make /dev/mem appear with filesize 0, but so does
/dev/zero already.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 1455e22 commit d60e9aa5f5a21374950dfd15bedafeccf76c3b1d
@Sascha Hauer Sascha Hauer authored on 4 Feb 2019
Showing 1 changed file
View
drivers/misc/mem.c