diff mbox

Btrfs: replace simple_strtoull() with kstrtoull() in btrfs_ioctl_resize()

Message ID 50E8F545.5030706@oracle.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

jeff.liu Jan. 6, 2013, 3:53 a.m. UTC
simple_strtoull() is obsolete, use kstrtoull() instead.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 fs/btrfs/ioctl.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

David Sterba Jan. 7, 2013, 4:03 p.m. UTC | #1
On Sun, Jan 06, 2013 at 11:53:41AM +0800, Jeff Liu wrote:
> -		devid = simple_strtoull(devstr, &end, 10);
> +		ret = kstrtoull(devstr, 10, &devid);
> +		if (ret) {
> +			pr_err("btrfs: resizer unable to parse device %s\n",
> +				devstr);

Code looks ok, I would prefer the message error text to say:

			pr_err("btrfs: resize unable to parse device id %s\n",
				devstr);

but that's maybe just me :)
david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 8fcf9a5..b147424 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1331,11 +1331,16 @@  static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
 	sizestr = vol_args->name;
 	devstr = strchr(sizestr, ':');
 	if (devstr) {
-		char *end;
 		sizestr = devstr + 1;
 		*devstr = '\0';
 		devstr = vol_args->name;
-		devid = simple_strtoull(devstr, &end, 10);
+		ret = kstrtoull(devstr, 10, &devid);
+		if (ret) {
+			pr_err("btrfs: resizer unable to parse device %s\n",
+				devstr);
+			ret = -EINVAL;
+			goto out_free;
+		}
 		printk(KERN_INFO "btrfs: resizing devid %llu\n",
 		       (unsigned long long)devid);
 	}