xfs
[Top] [All Lists]

[patch] xfs: bug widening binary "not" operation

To: Ben Myers <bpm@xxxxxxx>
Subject: [patch] xfs: bug widening binary "not" operation
From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date: Thu, 16 May 2013 10:53:30 +0300
Cc: Alex Elder <elder@xxxxxxxxxx>, xfs@xxxxxxxxxxx, kernel-janitors@xxxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-09-15)
The problem here is:

        ioffset = offset & ~(rounding - 1);

"offset" and "ioffset" are type xfs_off_t (__s64) and "rounding" is
unsigned int.  The "offset & ~(rounding - 1)" clears the high 32 bits
and which is unintentional.

This is a static checker fix so I'm not sure how much difference this
makes in real life.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 1501f4f..9f557c6 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1453,7 +1453,7 @@ xfs_free_file_space(
        xfs_mount_t             *mp;
        int                     nimap;
        uint                    resblks;
-       uint                    rounding;
+       xfs_off_t               rounding;
        int                     rt;
        xfs_fileoff_t           startoffset_fsb;
        xfs_trans_t             *tp;

<Prev in Thread] Current Thread [Next in Thread>