linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Yan Zheng <zheng.yan@oracle.com>, Josef Bacik <josef@redhat.com>,
	Sage Weil <sage@newdream.net>,
	Chris Mason <chris.mason@oracle.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch 9/11] btrfs: silence sparse warnings in ioctl.c
Date: Sat, 29 May 2010 11:48:01 +0200	[thread overview]
Message-ID: <20100529094801.GJ5483@bicker> (raw)

I fixed the following sparse warnings:

fs/btrfs/ioctl.c:1936:22: warning: cast removes address space of expression
fs/btrfs/ioctl.c:1939:26: warning: incorrect type in argument 1 (different address spaces)
fs/btrfs/ioctl.c:1939:26:    expected void [noderef] <asn:1>*to
fs/btrfs/ioctl.c:1939:26:    got struct btrfs_ioctl_space_info *[assigned] user_dest
fs/btrfs/ioctl.c:1872:6: warning: symbol 'btrfs_ioctl_space_info' was not declared. Should it be static?

Also I noticed that a related cast of "arg" could be removed so I did
that.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 4dbaf89..a945a66 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1869,21 +1869,19 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 	return 0;
 }
 
-long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
+static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
 {
 	struct btrfs_ioctl_space_args space_args;
 	struct btrfs_ioctl_space_info space;
 	struct btrfs_ioctl_space_info *dest;
 	struct btrfs_ioctl_space_info *dest_orig;
-	struct btrfs_ioctl_space_info *user_dest;
+	struct btrfs_ioctl_space_info __user *user_dest;
 	struct btrfs_space_info *info;
 	int alloc_size;
 	int ret = 0;
 	int slot_count = 0;
 
-	if (copy_from_user(&space_args,
-			   (struct btrfs_ioctl_space_args __user *)arg,
-			   sizeof(space_args)))
+	if (copy_from_user(&space_args, arg, sizeof(space_args)))
 		return -EFAULT;
 
 	/* first we count slots */
@@ -1933,7 +1931,7 @@ long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
 	}
 	rcu_read_unlock();
 
-	user_dest = (struct btrfs_ioctl_space_info *)
+	user_dest = (struct btrfs_ioctl_space_info __user *)
 		(arg + sizeof(struct btrfs_ioctl_space_args));
 
 	if (copy_to_user(user_dest, dest_orig, alloc_size))


                 reply	other threads:[~2010-05-29  9:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20100529094801.GJ5483@bicker \
    --to=error27@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=josef@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sage@newdream.net \
    --cc=zheng.yan@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).