From patchwork Tue Jan 8 07:04:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "jeff.liu" X-Patchwork-Id: 1944331 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 39944DF23A for ; Tue, 8 Jan 2013 07:05:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753648Ab3AHHFs (ORCPT ); Tue, 8 Jan 2013 02:05:48 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:17293 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750990Ab3AHHFr (ORCPT ); Tue, 8 Jan 2013 02:05:47 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r08753fs016353 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Jan 2013 07:05:04 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r08753V3010381 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 8 Jan 2013 07:05:03 GMT Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r08752ox010431; Tue, 8 Jan 2013 01:05:02 -0600 Received: from [192.168.1.103] (/114.248.203.221) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Jan 2013 23:05:02 -0800 Message-ID: <50EBC512.4020106@oracle.com> Date: Tue, 08 Jan 2013 15:04:50 +0800 From: Jeff Liu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: dsterba@suse.cz CC: linux-btrfs@vger.kernel.org Subject: Re: [PATCH] Btrfs: replace simple_strtoull() with kstrtoull() in btrfs_ioctl_resize() References: <50E8F545.5030706@oracle.com> <20130107160350.GI20089@twin.jikos.cz> In-Reply-To: <20130107160350.GI20089@twin.jikos.cz> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 01/08/2013 12:03 AM, David Sterba wrote: > 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 :) Thanks for the review, yours is better :) The revised patch was shown as following: simple_strtoull() is obsolete, use kstrtoull() instead. Signed-off-by: Jie Liu Cc: David Sterba --- fs/btrfs/ioctl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 8fcf9a5..d9045eb 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 id %s\n", + devstr); + ret = -EINVAL; + goto out_free; + } printk(KERN_INFO "btrfs: resizing devid %llu\n", (unsigned long long)devid); }