From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 7/7] misc: mem: Set correct size for /dev/mem
Date: Tue, 22 Jan 2019 17:13:38 -0800 [thread overview]
Message-ID: <20190123011338.32517-8-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20190123011338.32517-1-andrew.smirnov@gmail.com>
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.smirnov@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
prev parent reply other threads:[~2019-01-23 1:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 1:13 [PATCH 0/7] 32-bit lseek and /dev/mem fixes/improvements Andrey Smirnov
2019-01-23 1:13 ` [PATCH 1/7] commands: Move mem_parse_options() to lib/misc.c Andrey Smirnov
2019-01-23 1:13 ` [PATCH 2/7] commands: Get rid of mem_rw_buf Andrey Smirnov
2019-01-23 1:13 ` [PATCH 3/7] commands: Move /dev/mem driver to drivers/misc Andrey Smirnov
2019-01-23 1:13 ` [PATCH 4/7] fs: Change error checking logic for fsdrv->lseek() call Andrey Smirnov
2019-01-24 7:44 ` Sascha Hauer
2019-01-24 19:19 ` Andrey Smirnov
2019-01-23 1:13 ` [PATCH 5/7] fs: Calculate new position before validtiy check in lseek() Andrey Smirnov
2019-01-24 7:52 ` Sascha Hauer
2019-01-24 19:37 ` Andrey Smirnov
2019-01-23 1:13 ` [PATCH 6/7] fs: Add support for files larger than MAX_LFS_FILESIZE Andrey Smirnov
2019-01-24 8:48 ` Sascha Hauer
2019-01-24 19:43 ` Andrey Smirnov
2019-01-23 1:13 ` Andrey Smirnov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190123011338.32517-8-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox