From patchwork Mon May 19 03:26:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ZhangZhen X-Patchwork-Id: 350059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 59A9814008D for ; Mon, 19 May 2014 13:29:12 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WmEEo-0003zt-4T; Mon, 19 May 2014 03:27:42 +0000 Received: from szxga01-in.huawei.com ([119.145.14.64]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WmEEj-0003yf-Cl for linux-mtd@lists.infradead.org; Mon, 19 May 2014 03:27:40 +0000 Received: from 172.24.2.119 (EHLO szxeml212-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BVQ03682; Mon, 19 May 2014 11:26:38 +0800 (CST) Received: from SZXEML456-HUB.china.huawei.com (10.82.67.199) by szxeml212-edg.china.huawei.com (172.24.2.181) with Microsoft SMTP Server (TLS) id 14.3.158.1; Mon, 19 May 2014 11:26:35 +0800 Received: from [127.0.0.1] (10.111.69.77) by szxeml456-hub.china.huawei.com (10.82.67.199) with Microsoft SMTP Server id 14.3.158.1; Mon, 19 May 2014 11:26:34 +0800 Message-ID: <537979E9.3060209@huawei.com> Date: Mon, 19 May 2014 11:26:33 +0800 From: Zhang Zhen User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: , Subject: [PATCH] ubifs: replace simple_strtoul() with kstrtoul() References: <1400469756-18212-1-git-send-email-zhenzhang.zhang@huawei.com> In-Reply-To: <1400469756-18212-1-git-send-email-zhenzhang.zhang@huawei.com> X-Forwarded-Message-Id: <1400469756-18212-1-git-send-email-zhenzhang.zhang@huawei.com> X-Originating-IP: [10.111.69.77] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140518_202738_170196_13454459 X-CRM114-Status: GOOD ( 11.26 ) X-Spam-Score: -1.4 (-) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [119.145.14.64 listed in list.dnswl.org] -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org use the newer and more pleasant kstrtoul() to replace simple_strtoul(), because simple_strtoul() is marked for obsoletion. Signed-off-by: Zhang Zhen --- fs/ubifs/super.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index a81c7b5..a30f297 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1905,6 +1905,7 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode) struct ubi_volume_desc *ubi; int dev, vol; char *endptr; + int ret; /* First, try to open using the device node path method */ ubi = ubi_open_volume_path(name, mode); @@ -1922,7 +1923,10 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode) if (!isdigit(name[3])) return ERR_PTR(-EINVAL); - dev = simple_strtoul(name + 3, &endptr, 0); + endptr = (char *)name + 3; + ret = kstrtoul(endptr, 0, (unsigned long *)&dev); + if (ret) + return ERR_PTR(-EINVAL); /* ubiY method */ if (*endptr == '\0') @@ -1930,7 +1934,10 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode) /* ubiX_Y method */ if (*endptr == '_' && isdigit(endptr[1])) { - vol = simple_strtoul(endptr + 1, &endptr, 0); + endptr = endptr + 1; + ret = kstrtoul(endptr, 0, (unsigned long *)&vol); + if (ret) + return ERR_PTR(-EINVAL); if (*endptr != '\0') return ERR_PTR(-EINVAL); return ubi_open_volume(dev, vol, mode);