From patchwork Tue Jan 2 05:40:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gurumurthy, Anil" X-Patchwork-Id: 10139955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A4C8E6035E for ; Tue, 2 Jan 2018 05:41:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 938D828A22 for ; Tue, 2 Jan 2018 05:41:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92472285F9; Tue, 2 Jan 2018 05:41:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 213C3285F9 for ; Tue, 2 Jan 2018 05:41:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751589AbeABFlF (ORCPT ); Tue, 2 Jan 2018 00:41:05 -0500 Received: from mail-sn1nam02on0067.outbound.protection.outlook.com ([104.47.36.67]:8844 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751109AbeABFlE (ORCPT ); Tue, 2 Jan 2018 00:41:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kmzeTq9N6VzdK14Il1ixfRbKx5s7cw/MSigpSCeGVyQ=; b=lG8StAjHIn/1tiMUwoTTwr47NAeBCozTHYEaQFE4aVzaH5ytfqZEso2bo39Q9DW7/A8/SJlGiWu+nxpMGrV8/dz3aSFTfneGJUhHSMboUCBeSy7psQxdkEPgvGGJsFiYmn+Bv6p+WhvQ9QEvrpQpXmKUhIZm8xqpiJ6wz4nBaSs= Received: from SN1PR0701MB2031.namprd07.prod.outlook.com (10.163.132.14) by BN6PR07MB3041.namprd07.prod.outlook.com (10.172.106.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 2 Jan 2018 05:40:59 +0000 Received: from SN1PR0701MB2031.namprd07.prod.outlook.com ([10.163.132.14]) by SN1PR0701MB2031.namprd07.prod.outlook.com ([10.163.132.14]) with mapi id 15.20.0366.007; Tue, 2 Jan 2018 05:40:58 +0000 From: "Gurumurthy, Anil" To: Himanshu Jha , "jejb@linux.vnet.ibm.com" , "martin.petersen@oracle.com" , "aacraid@adaptec.com" CC: "Kalluru, Sudarsana" , Dept-Eng QLogic Storage Upstream , "satishkh@cisco.com" , "sebaddel@cisco.com" , "kartilak@cisco.com" , Dept-Eng QLogic Storage Upstream , Dept-Eng QLA2xxx Upstream , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 8/9] scsi: bfa: Use zeroing allocator rather than allocator/memset Thread-Topic: [PATCH 8/9] scsi: bfa: Use zeroing allocator rather than allocator/memset Thread-Index: AQHTgYMfSgXfHlyt70WaJ9zmqCxNbaNgFTvQ Date: Tue, 2 Jan 2018 05:40:58 +0000 Message-ID: References: <1514647712-6332-1-git-send-email-himanshujha199640@gmail.com> <1514647712-6332-9-git-send-email-himanshujha199640@gmail.com> In-Reply-To: <1514647712-6332-9-git-send-email-himanshujha199640@gmail.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anil.Gurumurthy@cavium.com; x-originating-ip: [114.143.185.87] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BN6PR07MB3041; 7:Zjq7l1cDnODSyzwbxpbAzYMGK3v0W+/RCIWbphndRZ/jWbH5BdcM7bPQcMsAVBD2pjfXJ04TZDGUroxXMs9QhlpviXXXSDDABguVvoSr0I4w+Dx3v7gQb+RwJnlbkotuR1MNA4kU3a8Cu2+HOLFTDDJfurfB6wrM+KwG6eZdmgF+5z8nFLyqEQiA8pXy/oUAUY/Pjwb6AjQrFexkR9F9ZbxUMl4s1ZAZEQE+rJ70Ds5TzF+VMbgwOoX607zjvUFH x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-ms-office365-filtering-correlation-id: b778e916-c806-4dbd-914a-08d551a366d9 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060); SRVR:BN6PR07MB3041; x-ms-traffictypediagnostic: BN6PR07MB3041: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(95692535739014)(104084551191319)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231023)(944501075)(6041268)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:BN6PR07MB3041; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN6PR07MB3041; x-forefront-prvs: 0540846A1D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39850400004)(366004)(39380400002)(396003)(346002)(199004)(13464003)(189003)(102836004)(305945005)(2201001)(2501003)(86362001)(66066001)(106356001)(77096006)(2900100001)(97736004)(105586002)(5660300001)(74316002)(2950100002)(7736002)(54906003)(53936002)(9686003)(76176011)(478600001)(3280700002)(6436002)(55016002)(33656002)(3846002)(8936002)(72206003)(53546011)(6506007)(6246003)(14454004)(25786009)(81156014)(7696005)(110136005)(99286004)(59450400001)(8676002)(4326008)(3660700001)(39060400002)(229853002)(316002)(68736007)(81166006)(6116002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3041; H:SN1PR0701MB2031.namprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Q+LL5/dmyN0n0BPMmXcAonhupAk36X7PMdOYD1M4uAM61nIrBPVYZGsuthIEjRmLoJrbRF0ZsGl+r++Fz31TrQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: b778e916-c806-4dbd-914a-08d551a366d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2018 05:40:58.7971 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3041 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP -----Original Message----- From: Himanshu Jha [mailto:himanshujha199640@gmail.com] Sent: 30 December 2017 20:59 To: jejb@linux.vnet.ibm.com; martin.petersen@oracle.com; aacraid@adaptec.com Cc: Gurumurthy, Anil ; Kalluru, Sudarsana ; Dept-Eng QLogic Storage Upstream ; satishkh@cisco.com; sebaddel@cisco.com; kartilak@cisco.com; Dept-Eng QLogic Storage Upstream ; Dept-Eng QLA2xxx Upstream ; linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; Himanshu Jha Subject: [PATCH 8/9] scsi: bfa: Use zeroing allocator rather than allocator/memset Use vzalloc instead of vmalloc followed by memset 0. Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Suggested-by: Luis R. Rodriguez Signed-off-by: Himanshu Jha --- drivers/scsi/bfa/bfad.c | 3 +-- drivers/scsi/bfa/bfad_debugfs.c | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) return -ENOMEM; } - memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); - spin_lock_irqsave(&bfad->bfad_lock, flags); rc = bfa_ioc_debug_fwtrc(&bfad->bfa.ioc, fw_debug->debug_buffer, @@ -125,7 +123,7 @@ bfad_debugfs_open_fwsave(struct inode *inode, struct file *file) fw_debug->buffer_len = sizeof(struct bfa_trc_mod_s); - fw_debug->debug_buffer = vmalloc(fw_debug->buffer_len); + fw_debug->debug_buffer = vzalloc(fw_debug->buffer_len); if (!fw_debug->debug_buffer) { kfree(fw_debug); printk(KERN_INFO "bfad[%d]: Failed to allocate fwsave buffer\n", @@ -133,8 +131,6 @@ bfad_debugfs_open_fwsave(struct inode *inode, struct file *file) return -ENOMEM; } - memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); - spin_lock_irqsave(&bfad->bfad_lock, flags); rc = bfa_ioc_debug_fwsave(&bfad->bfa.ioc, fw_debug->debug_buffer, -- 2.7.4 Acked by: Anil Gurumurthy diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index bac18f6..bd7e6a6f 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -610,13 +610,12 @@ bfad_hal_mem_alloc(struct bfad_s *bfad) /* Iterate through the KVA meminfo queue */ list_for_each(km_qe, &kva_info->qe) { kva_elem = (struct bfa_mem_kva_s *) km_qe; - kva_elem->kva = vmalloc(kva_elem->mem_len); + kva_elem->kva = vzalloc(kva_elem->mem_len); if (kva_elem->kva == NULL) { bfad_hal_mem_release(bfad); rc = BFA_STATUS_ENOMEM; goto ext; } - memset(kva_elem->kva, 0, kva_elem->mem_len); } /* Iterate through the DMA meminfo queue */ diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c index 05f5239..349cfe7 100644 --- a/drivers/scsi/bfa/bfad_debugfs.c +++ b/drivers/scsi/bfa/bfad_debugfs.c @@ -81,7 +81,7 @@ bfad_debugfs_open_fwtrc(struct inode *inode, struct file *file) fw_debug->buffer_len = sizeof(struct bfa_trc_mod_s); - fw_debug->debug_buffer = vmalloc(fw_debug->buffer_len); + fw_debug->debug_buffer = vzalloc(fw_debug->buffer_len); if (!fw_debug->debug_buffer) { kfree(fw_debug); printk(KERN_INFO "bfad[%d]: Failed to allocate fwtrc buffer\n", @@ -89,8 +89,6 @@ bfad_debugfs_open_fwtrc(struct inode *inode, struct file *file)