Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5339198imm; Tue, 18 Sep 2018 08:02:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbpbmcrfOvJb/a27FD/xC+/4lAOAlCLeheKFwqHxBQJwpcNst/2TLCdrzvQc9UbeD2nFFkh X-Received: by 2002:a17:902:a613:: with SMTP id u19-v6mr30174440plq.234.1537282969639; Tue, 18 Sep 2018 08:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537282969; cv=none; d=google.com; s=arc-20160816; b=PxIiydfVZckGcZr9sJobHnlduHC8IDagcaln5X37UeipMYIWpkTZM244pprYqCw1qv DE8SgYGxqO/xF+uYnIsn5wA2iyfNlzDVabJEi5l1c/R1lL+GjKBa3MQKyhY9tbJdhP2r msx3vioDWOhb3kVwn3RTfbsUgWx3zLDCPOhUY7UgzR0A9DwFtSpOoMR01I9nETiKuhTn aoc1ytmjmt9khyZJCGJvdIsXXYq4rhm+E/pWoeOZDU5VFKTGf35vWX+bPucb+4K9++Xv G1+rR3WOBFFDKBG7bnPoBgAxHAiNnBaFo8PilNA0ZDZj/aGpAf9/oybNdaZIkhPnkYeJ WkUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=kEIXLNWRzzFOC0FhKJHZeSh+7zSGSXrpkkzIo/pi+9E=; b=Jkenj2NW9ON6Q6jFUwLfLXivM8i455FkGl+q8BA7MCYK0llTYqeT9YvoXklJGoUFqJ hzetV0j6lERmXrawJOVxghZ89g3XycEuSqGIHCo4vvD+ywL5mSke4n1RlLQABF4xeVq4 aZ3FOS0QJataZ+HaSY8jHd2zNd6EHn1bdEFt1dt6jn8ALP8eNFp1ldUlFRLF6bBsbhS/ rQ+oIxJR1GHPhHkopz+q0pBi4u6yXMB7lHGNTHMznnICXj0A7xapndL7ZzG2iBsAJ+B+ Oosb0sHZXnD+nxUA5yGP6/VOgtrAIza7wAPSi5dI7AWarkdBhFqOtLdbw6XNAXDYmvT1 H0yA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 21-v6si19292496pgg.588.2018.09.18.08.02.31; Tue, 18 Sep 2018 08:02:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729919AbeIRUdk (ORCPT + 99 others); Tue, 18 Sep 2018 16:33:40 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:12610 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727756AbeIRUdk (ORCPT ); Tue, 18 Sep 2018 16:33:40 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id EAF54B1DD756C; Tue, 18 Sep 2018 23:00:37 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.399.0; Tue, 18 Sep 2018 23:00:38 +0800 Message-ID: <5BA11315.4060908@huawei.com> Date: Tue, 18 Sep 2018 23:00:37 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Greg KH CC: , , , , Subject: Re: [PATCH v2] scsi: Use vmemdup_user to replace the open code References: <1534164200-28408-1-git-send-email-zhongjiang@huawei.com> <5B7E9CCE.5010007@huawei.com> In-Reply-To: <5B7E9CCE.5010007@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Greg Can you pick up the patch? Thanks, zhong jiang On 2018/8/23 19:38, zhong jiang wrote: > On 2018/8/13 22:20, Don.Brace@microchip.com wrote: >>> -----Original Message----- >>> From: zhong jiang [mailto:zhongjiang@huawei.com] >>> Sent: Monday, August 13, 2018 7:43 AM >>> To: don.brace@microsemi.com; jejb@linux.vnet.ibm.com; >>> martin.petersen@oracle.com >>> Cc: linux-kernel@vger.kernel.org >>> Subject: [PATCH v2] scsi: Use vmemdup_user to replace the open code >>> >>> EXTERNAL EMAIL >>> >>> >>> EXTERNAL EMAIL >>> >>> >>> vmemdup_user is better than duplicating its implementation, So just >>> replace the open code. >>> >>> The issue is detected with the help of Coccinelle. >>> >>> Signed-off-by: zhong jiang >> Tested-by: Don Brace >> Acked-by: Don Brace > Thanks Don for your test and ack. > > Martin , Can you pick up the patch, Thanks > > Best wishes, > zhong jiang >>> --- >>> drivers/scsi/hpsa.c | 12 ++++-------- >>> 1 file changed, 4 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c >>> index 58bb70b..666ba09e5 100644 >>> --- a/drivers/scsi/hpsa.c >>> +++ b/drivers/scsi/hpsa.c >>> @@ -6381,13 +6381,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info >>> *h, void __user *argp) >>> return -EINVAL; >>> if (!capable(CAP_SYS_RAWIO)) >>> return -EPERM; >>> - ioc = kmalloc(sizeof(*ioc), GFP_KERNEL); >>> - if (!ioc) { >>> - status = -ENOMEM; >>> - goto cleanup1; >>> - } >>> - if (copy_from_user(ioc, argp, sizeof(*ioc))) { >>> - status = -EFAULT; >>> + ioc = vmemdup_user(argp, sizeof(*ioc)); >>> + if (IS_ERR(ioc)) { >>> + status = PTR_ERR(ioc); >>> goto cleanup1; >>> } >>> if ((ioc->buf_size < 1) && >>> @@ -6505,7 +6501,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, >>> void __user *argp) >>> kfree(buff); >>> } >>> kfree(buff_size); >>> - kfree(ioc); >>> + kvfree(ioc); >>> return status; >>> } >>> >>> -- >>> 1.7.12.4 >> > > > . >