From patchwork Fri Jul 19 07:02:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 2830258 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 369E29F4D5 for ; Fri, 19 Jul 2013 07:02:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE4F920283 for ; Fri, 19 Jul 2013 07:02:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF0D22028F for ; Fri, 19 Jul 2013 07:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759729Ab3GSHCq (ORCPT ); Fri, 19 Jul 2013 03:02:46 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:29439 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759747Ab3GSHCp (ORCPT ); Fri, 19 Jul 2013 03:02:45 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MQ6002KG8UZV0U0@mailout1.samsung.com> for linux-mmc@vger.kernel.org; Fri, 19 Jul 2013 16:02:44 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.47]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 72.5D.03969.494E8E15; Fri, 19 Jul 2013 16:02:44 +0900 (KST) X-AuditID: cbfee68f-b7f436d000000f81-e4-51e8e49468fb Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C4.63.31505.394E8E15; Fri, 19 Jul 2013 16:02:43 +0900 (KST) Received: from DOJG1HAN03 ([12.23.120.99]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MQ6002PQ8WJHZI0@mmp1.samsung.com>; Fri, 19 Jul 2013 16:02:43 +0900 (KST) From: Jingoo Han To: Chris Ball Cc: linux-mmc@vger.kernel.org, Jingoo Han Subject: [PATCH] mmc: mmc_test: replace strict_strtol() with kstrtol_from_user() Date: Fri, 19 Jul 2013 16:02:43 +0900 Message-id: <000c01ce844d$f75ba650$e612f2f0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac6ETdZU8aio5dJKRsqh9xqUrhoSlA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRmVeSWpSXmKPExsVy+t8zfd0pT14EGlzoY7LY/nojm8XlhZdY LY7872d0YPY4dGUto0ffllWMHp83yQUwR3HZpKTmZJalFunbJXBlTLx0gKngCWfF3v421gbG do4uRk4OCQETiXMTf7NB2GISF+6tB7OFBJYxSjztMoOp2Xf5KUsXIxdQfBGjxNYbN9ghnF+M EjP37GQBqWITUJP48uUwO4gtIiAvcb/vG9gkZgF7ib6FHUA1HBzCAgESbx+Kg4RZBFQl3r3t ZQKxeQUsJU4cbGKBsAUlfky+xwLRqiWxfudxJghbXmLzmrfMEAcpSOw4+5oRYpWexLYl16Fq RCT2vXjHCHKbhMAydokHc36xQiwTkPg2+RDYDRICshKbDkDNkZQ4uOIGywRGsVlIVs9CsnoW ktWzkKxYwMiyilE0tSC5oDgpvchYrzgxt7g0L10vOT93EyMkovp3MN49YH2IMRlo/URmKdHk fGBE5pXEGxqbGVmYmpgaG5lbmpEmrCTOq9ZiHSgkkJ5YkpqdmlqQWhRfVJqTWnyIkYmDU6qB 8cikA3slGJ590T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y WAKQHAMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The usage of strict_strtol() is not preferred, because strict_strtol() is obsolete. Thus, kstrtol() should be used. Also, both kstrtol() and copy_from_user() can be replaced with kstrtol_from_user() to make the code simpler. Signed-off-by: Jingoo Han --- drivers/mmc/card/mmc_test.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index a69df52..0c0fc52 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c @@ -2849,18 +2849,12 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, struct seq_file *sf = (struct seq_file *)file->private_data; struct mmc_card *card = (struct mmc_card *)sf->private; struct mmc_test_card *test; - char lbuf[12]; long testcase; + int ret; - if (count >= sizeof(lbuf)) - return -EINVAL; - - if (copy_from_user(lbuf, buf, count)) - return -EFAULT; - lbuf[count] = '\0'; - - if (strict_strtol(lbuf, 10, &testcase)) - return -EINVAL; + ret = kstrtol_from_user(buf, count, 10, &testcase); + if (ret) + return ret; test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL); if (!test)