Received: by 10.223.164.221 with SMTP id h29csp973379wrb; Wed, 11 Oct 2017 12:43:31 -0700 (PDT) X-Received: by 10.98.72.196 with SMTP id q65mr69620pfi.343.1507751011781; Wed, 11 Oct 2017 12:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507751011; cv=none; d=google.com; s=arc-20160816; b=KyjTHiO5Rj6flO80LzRTYwFKd4GTEYoT85X+TSYuxl4g69HLb/8PK5h2qhJQkrDnuO tc/QERcGs/Ig/ACknv/A0xZpp1IzeK/EhfyBFUNBB6MWVxPmtZqWYyWSDEm0pY+PKPKz KClLEI6KejCwOeuPMNFKP7TKYmtnX1e/GR3AIn20GcrOmlZr8diNrcI5awOc3adMziQH 90IJ6RhyR6sibQAgGlkEZw0uPYUsViut4Qhy91ePyeAkDM/pQcITr8dXtMZxnbiWL5eN QSCzBG93w5l2+iSwuv1Ss5nm7phc9jXMhgIK0wo0t4/R6SP0+jJfsmpq6BwJoV2+PREy Xa0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=OGAGAH8IcjnMAyWaYOhiHZmJdQiU0RgJ98aNXIumOJE=; b=YUCx3H047fhdtT/CPXHjao/95f2zUEbfJJJ4OU7ouaQ/ErNdGubor1FVZs3Da99Ka5 ZjL69ew6C2qj1iqD1imyrN9tyUqz+oXIxrghyLyODMRZdTyWdrpUEs8b/Y8MAr2fqwhQ Ul0MXtmaDCZ1jj6pmUmsWUz3uHoPC7ylIRnI272fgrUmAkfa3gWMvVP6F506vTOFjCQ4 dZbdGM00KGjtfHPhqQIPgT2N++oE27Ta7IqwaGvnFa9uDbQxZFND3BloS9bKm289+9Nb Rahi94OSaZ2jCEkEmCYA5Q4yNJIO7xZA+cRsZ23f/G5FmzFK8fPrEbjLcAJ4hc87xORc 991g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lmbsIqxn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si11409696pfc.488.2017.10.11.12.43.17; Wed, 11 Oct 2017 12:43:31 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lmbsIqxn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757553AbdJKTmy (ORCPT + 99 others); Wed, 11 Oct 2017 15:42:54 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:36900 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254AbdJKTmw (ORCPT ); Wed, 11 Oct 2017 15:42:52 -0400 Received: by mail-lf0-f66.google.com with SMTP id 90so1068471lfs.4; Wed, 11 Oct 2017 12:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=OGAGAH8IcjnMAyWaYOhiHZmJdQiU0RgJ98aNXIumOJE=; b=lmbsIqxnauwEQbf7zHebGqsWQzBRe/x/Fo2tQlKxDxWTk61xZIZm8HqG673eCa+Zn/ ESRP25vuSO7tKQWIeq+/GQN8usE3nCjPLt8GgQuU7EsVX7Ewhr1OXBl071GVDrZqiNE+ QYSO4uBKIOnc+l4p9mRh55HS8Z5qgorRQ4pEwzwR9RxdBEihSxHvyKOkQ4KjntfhSkOO PM2Zok7txEbhBxjA4PVJLawW6vsXK578nU0nEAmaGTlo2wd2T76nL9eMTKZMkFevq5wU woc21rY/09jxekJGeYLuKVwa5mHwWD9pxhiAOextSj+Qtcnrms8pWChuKGHj1PSx4OLI lexA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OGAGAH8IcjnMAyWaYOhiHZmJdQiU0RgJ98aNXIumOJE=; b=k9B0zqaFUfmhwSMMvuxeup2NnlHR7e6ns2xUtl/RwfuDQZSkAaZu9Bm0ZHaZmignGh nPp9JMnX3PyJswDE+sRFoOBnZRzKEG4QEOs71hHxjH9woWH1ztM5sGqNLk6z6HieU3JL 4hwP/muMqKjYPtNFQaVFZLrt8TDeDdwDxaMB4ceTL9gOA5x9fOqKI2ucI7c2YtRKBleW WUWFwH6lQxi1Tv/ie64sbd9I6Wou/vt+M/GJ+WrcBvEXQxWQnPRb5Qd/+ib99vjmaOTi fBgZlMaRvwxb1Pal9WxwV9mDfXU0AucT8GdDbbDyQSXjpaLMmNMjHtXw9lCVQM9Z9Dn8 cC2Q== X-Gm-Message-State: AMCzsaXJZadqm/XRpHQ4n8/kKn/O9aTu9WvlU8ZtHveOKclMQHuz23pv T9BDx2wwHUPRxBYcNaaNXhzWGzGH X-Google-Smtp-Source: AOwi7QCAtVlZVjbrZo6m+9A5+Idvz1exRgOsWRgrwFjXrOHjxAcnlimO9GwaiKFqwmYjtJxPk5Jmfw== X-Received: by 10.46.89.199 with SMTP id g68mr50562ljf.12.1507750970634; Wed, 11 Oct 2017 12:42:50 -0700 (PDT) Received: from localhost.localdomain ([195.254.138.66]) by smtp.gmail.com with ESMTPSA id f196sm2364760lff.83.2017.10.11.12.42.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Oct 2017 12:42:50 -0700 (PDT) From: Vasyl Gomonovych To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: james.smart@broadcom.com, dick.kennedy@broadcom.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, gomonovych@gmail.com Subject: [PATCH] scsi: lpfc: fix kzalloc-simple.cocci warnings Date: Wed, 11 Oct 2017 21:42:41 +0200 Message-Id: <1507750961-26945-1-git-send-email-gomonovych@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org drivers/scsi/lpfc/lpfc_debugfs.c:5460:22-29: WARNING: kzalloc should be used for phba -> nvmeio_trc, instead of kmalloc/memset drivers/scsi/lpfc/lpfc_debugfs.c:2230:20-27: WARNING: kzalloc should be used for phba -> nvmeio_trc, instead of kmalloc/memset Use kzalloc rather than kmalloc followed by memset with 0 Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Signed-off-by: Vasyl Gomonovych --- drivers/scsi/lpfc/lpfc_debugfs.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index d50c481..2bf5ad3 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -2227,7 +2227,7 @@ kfree(phba->nvmeio_trc); /* Allocate new trace buffer and initialize */ - phba->nvmeio_trc = kmalloc((sizeof(struct lpfc_debugfs_nvmeio_trc) * + phba->nvmeio_trc = kzalloc((sizeof(struct lpfc_debugfs_nvmeio_trc) * sz), GFP_KERNEL); if (!phba->nvmeio_trc) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, @@ -2235,8 +2235,6 @@ "nvmeio_trc buffer\n"); return -ENOMEM; } - memset(phba->nvmeio_trc, 0, - (sizeof(struct lpfc_debugfs_nvmeio_trc) * sz)); atomic_set(&phba->nvmeio_trc_cnt, 0); phba->nvmeio_trc_on = 0; phba->nvmeio_trc_output_idx = 0; @@ -5457,7 +5455,7 @@ static int lpfc_idiag_cmd_get(const char __user *buf, size_t nbytes, phba->nvmeio_trc_size = lpfc_debugfs_max_nvmeio_trc; /* Allocate trace buffer and initialize */ - phba->nvmeio_trc = kmalloc( + phba->nvmeio_trc = kzalloc( (sizeof(struct lpfc_debugfs_nvmeio_trc) * phba->nvmeio_trc_size), GFP_KERNEL); @@ -5467,9 +5465,6 @@ static int lpfc_idiag_cmd_get(const char __user *buf, size_t nbytes, "nvmeio_trc buffer\n"); goto nvmeio_off; } - memset(phba->nvmeio_trc, 0, - (sizeof(struct lpfc_debugfs_nvmeio_trc) * - phba->nvmeio_trc_size)); phba->nvmeio_trc_on = 1; phba->nvmeio_trc_output_idx = 0; phba->nvmeio_trc = NULL; -- 1.9.1 From 1583088706782436132@xxx Fri Nov 03 23:17:20 +0000 2017 X-GM-THRID: 1583088257880633562 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread