On 64-bit platfoms /dev/mem should have the size of 2^64 bytes, not
2^63 which would result from using S64_MAX. This also has a side
effect of setting "size" in FILE to FILE_SIZE_STREAM, disabling a
number of codepaths that are not applicable to /dev/mem anyway (see
__read() and __write()).

Signed-off-by: Andrey Smirnov <andrew.smir...@gmail.com>
---
 drivers/misc/mem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/mem.c b/drivers/misc/mem.c
index b27865b9e..89ec920b2 100644
--- a/drivers/misc/mem.c
+++ b/drivers/misc/mem.c
@@ -23,8 +23,7 @@ static int mem_probe(struct device_d *dev)
 
        cdev->flags = DEVFS_UNBOUNDED;
        cdev->name = (char*)dev->resource[0].name;
-       cdev->size = min_t(unsigned long long, resource_size(&dev->resource[0]),
-                          S64_MAX);
+       cdev->size = resource_size(&dev->resource[0]);
        cdev->ops = &memops;
        cdev->dev = dev;
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to