mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@googlemail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] fs: fs.c fix cast
Date: Tue, 11 Sep 2012 07:31:31 +0200	[thread overview]
Message-ID: <1347341491-2647-1-git-send-email-alex.aring@gmail.com> (raw)

Fix casting on min argument, to avoid warnings on 64bit build.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 fs/fs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 38917bf..db4621a 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1525,7 +1525,9 @@ ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulon
 		return -1;
 	dev = cdev->dev;
 
-	size = min((loff_t)count, resource_size(&dev->resource[0]) - offset);
+	size = min((resource_size_t)count,
+			resource_size(&dev->resource[0]) -
+			(resource_size_t)offset);
 	memcpy_sz(buf, dev_get_mem_region(dev, 0) + offset, size, flags & O_RWSIZE_MASK);
 	return size;
 }
@@ -1540,7 +1542,9 @@ ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, loff_t offse
 		return -1;
 	dev = cdev->dev;
 
-	size = min((loff_t)count, resource_size(&dev->resource[0]) - offset);
+	size = min((resource_size_t)count,
+			resource_size(&dev->resource[0]) -
+			(resource_size_t)offset);
 	memcpy_sz(dev_get_mem_region(dev, 0) + offset, buf, size, flags & O_RWSIZE_MASK);
 	return size;
 }
-- 
1.7.12


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

             reply	other threads:[~2012-09-11  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11  5:31 Alexander Aring [this message]
2012-09-11  7:20 ` Sascha Hauer

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=1347341491-2647-1-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@googlemail.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