diff mbox

[V3,11/7] Orangefs: large integer implicitly truncated to unsigned type

Message ID 1438288381-12327-1-git-send-email-hubcap@logtruck.clemson.edu (mailing list archive)
State New, archived
Headers show

Commit Message

Mike Marshall July 30, 2015, 8:33 p.m. UTC
From: Mike Marshall <hubcap@omnibond.com>

make.cross ARCH=tile doesn't like "inode->i_bytes = PAGE_CACHE_SIZE;",
so cast PAGE_CACHE_SIZE to unsigned short.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
---
 fs/orangefs/pvfs2-utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Christoph Hellwig July 31, 2015, 7:36 a.m. UTC | #1
On Thu, Jul 30, 2015 at 04:33:01PM -0400, hubcap wrote:
> From: Mike Marshall <hubcap@omnibond.com>
> 
> make.cross ARCH=tile doesn't like "inode->i_bytes = PAGE_CACHE_SIZE;",
> so cast PAGE_CACHE_SIZE to unsigned short.

I don't think this is correct.  i_bytes is short because it only
contains the low bits of th size, the rest goes into i_blocks.

You probably want to use inode_set_bytes here instead.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Al Viro July 31, 2015, 8:26 a.m. UTC | #2
On Fri, Jul 31, 2015 at 12:36:22AM -0700, Christoph Hellwig wrote:
> On Thu, Jul 30, 2015 at 04:33:01PM -0400, hubcap wrote:
> > From: Mike Marshall <hubcap@omnibond.com>
> > 
> > make.cross ARCH=tile doesn't like "inode->i_bytes = PAGE_CACHE_SIZE;",
> > so cast PAGE_CACHE_SIZE to unsigned short.
> 
> I don't think this is correct.  i_bytes is short because it only
> contains the low bits of th size, the rest goes into i_blocks.
> 
> You probably want to use inode_set_bytes here instead.

... or just leave ->i_bytes zero, what with PAGE_CACHE_SIZE being a multiple
of 512...
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/orangefs/pvfs2-utils.c b/fs/orangefs/pvfs2-utils.c
index 8d4411c..6eecb18 100644
--- a/fs/orangefs/pvfs2-utils.c
+++ b/fs/orangefs/pvfs2-utils.c
@@ -163,7 +163,7 @@  static int copy_attributes_to_inode(struct inode *inode,
 		/*FALLTHRU*/
 	default:
 		pvfs2_lock_inode(inode);
-		inode->i_bytes = PAGE_CACHE_SIZE;
+		inode->i_bytes = (unsigned short)PAGE_CACHE_SIZE;
 		inode->i_blocks = (unsigned long)(PAGE_CACHE_SIZE / 512);
 		pvfs2_unlock_inode(inode);