Commit 745c4d8e authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Chris Mason

btrfs: Fix up 32/64-bit compatibility for new ioctls

 This patch casts to unsigned long before casting to a pointer and fixes
 the following warnings:
fs/btrfs/extent_io.c:2289:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
fs/btrfs/ioctl.c:2933:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
fs/btrfs/ioctl.c:2937:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
fs/btrfs/ioctl.c:3020:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
fs/btrfs/scrub.c:275:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
fs/btrfs/backref.c:686:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 387125fc
...@@ -683,7 +683,7 @@ static int inode_to_path(u64 inum, struct btrfs_inode_ref *iref, ...@@ -683,7 +683,7 @@ static int inode_to_path(u64 inum, struct btrfs_inode_ref *iref,
return PTR_ERR(fspath); return PTR_ERR(fspath);
if (fspath > fspath_min) { if (fspath > fspath_min) {
ipath->fspath->val[i] = (u64)fspath; ipath->fspath->val[i] = (u64)(unsigned long)fspath;
++ipath->fspath->elem_cnt; ++ipath->fspath->elem_cnt;
ipath->fspath->bytes_left = fspath - fspath_min; ipath->fspath->bytes_left = fspath - fspath_min;
} else { } else {
......
...@@ -2286,7 +2286,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err) ...@@ -2286,7 +2286,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
} }
if (!uptodate) { if (!uptodate) {
u64 failed_mirror; u64 failed_mirror;
failed_mirror = (u64)bio->bi_bdev; failed_mirror = (unsigned long)bio->bi_bdev;
if (tree->ops && tree->ops->readpage_io_failed_hook) if (tree->ops && tree->ops->readpage_io_failed_hook)
ret = tree->ops->readpage_io_failed_hook( ret = tree->ops->readpage_io_failed_hook(
bio, page, start, end, bio, page, start, end,
......
...@@ -2930,11 +2930,13 @@ static long btrfs_ioctl_ino_to_path(struct btrfs_root *root, void __user *arg) ...@@ -2930,11 +2930,13 @@ static long btrfs_ioctl_ino_to_path(struct btrfs_root *root, void __user *arg)
goto out; goto out;
for (i = 0; i < ipath->fspath->elem_cnt; ++i) { for (i = 0; i < ipath->fspath->elem_cnt; ++i) {
rel_ptr = ipath->fspath->val[i] - (u64)ipath->fspath->val; rel_ptr = ipath->fspath->val[i] -
(u64)(unsigned long)ipath->fspath->val;
ipath->fspath->val[i] = rel_ptr; ipath->fspath->val[i] = rel_ptr;
} }
ret = copy_to_user((void *)ipa->fspath, (void *)ipath->fspath, size); ret = copy_to_user((void *)(unsigned long)ipa->fspath,
(void *)(unsigned long)ipath->fspath, size);
if (ret) { if (ret) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
...@@ -3017,7 +3019,8 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root, ...@@ -3017,7 +3019,8 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = copy_to_user((void *)loi->inodes, (void *)inodes, size); ret = copy_to_user((void *)(unsigned long)loi->inodes,
(void *)(unsigned long)inodes, size);
if (ret) if (ret)
ret = -EFAULT; ret = -EFAULT;
......
...@@ -272,7 +272,7 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root, void *ctx) ...@@ -272,7 +272,7 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root, void *ctx)
swarn->logical, swarn->dev->name, swarn->logical, swarn->dev->name,
(unsigned long long)swarn->sector, root, inum, offset, (unsigned long long)swarn->sector, root, inum, offset,
min(isize - offset, (u64)PAGE_SIZE), nlink, min(isize - offset, (u64)PAGE_SIZE), nlink,
(char *)ipath->fspath->val[i]); (char *)(unsigned long)ipath->fspath->val[i]);
free_ipath(ipath); free_ipath(ipath);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment