From patchwork Fri Jan 5 13:27:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10146567 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 8E7EE601A1 for ; Fri, 5 Jan 2018 13:29:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E63A287CD for ; Fri, 5 Jan 2018 13:29:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 736FD287D3; Fri, 5 Jan 2018 13:29:12 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham 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 0EF59287CD for ; Fri, 5 Jan 2018 13:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751645AbeAEN3L (ORCPT ); Fri, 5 Jan 2018 08:29:11 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35014 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbeAEN3K (ORCPT ); Fri, 5 Jan 2018 08:29:10 -0500 Received: by mail-pf0-f195.google.com with SMTP id j124so2182026pfc.2 for ; Fri, 05 Jan 2018 05:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iZvkaCzmqMTomNN5s7Jz319PTMs9RXPKNH1m0yRhrdU=; b=BrgiWCYp14BSNyCcyEPwZ8489rqv5JG2fy0iCj5h+aP4tqPn/62rznAn1HFZK3XVe0 z7eq9ZmyadaoabjFdWXkx/J/9no7Brl+thGm1lo9+LoThnmO2mVvSEoOTYCjOHQPZS4l izxHClAe7wJpNk1PzVzU/K/+Wyc09fV9z50Oc= 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:in-reply-to :references; bh=iZvkaCzmqMTomNN5s7Jz319PTMs9RXPKNH1m0yRhrdU=; b=GYeIXklKn4XdCtGjnZhb4hbWgqZQVhS5yTmOErB/hzB9wXFAAE+nLE/LlBjMPG/FUI mL20Iv0mjpw9Jk8WWUAD2waPzsgMH+zTon12idipw/a2pQ6ztWHVl8N8ei0W8pjY7S/l JPkgrF39sGUvhURA+Gh6JMDutJr4i/0VF+DGUnf3P+z9din+vVLHvu14FgnJxBAFlhz4 OLsRNkF6dSCftuOZIKLE7hG4EPJ9aPZux5+U0Fz4IgaGIFHFtDHK1/PvWrivhQXjQkU7 fmE+InKK3qd3s8pVJIe9feTcY/8UF2CRT5p0fUX8WSEcicDI1mOiWlXiA5TJfPmSRm1/ GeMw== X-Gm-Message-State: AKGB3mJkYB+SVr58CIk+tRBZnBjCcqgc5/gxAOuho9aoedvr7rtdyYhM tCPH2tc03SYzY2vjH1mipk8V8N1g X-Google-Smtp-Source: ACJfBouhQ1qz3Uu+IkWOYDeyF4QHbLz33UFNcmRLkMUJODROUYD/VMxi8saHu9shojgAkkdIl1ue/Q== X-Received: by 10.98.215.76 with SMTP id v12mr2975348pfl.202.1515158949781; Fri, 05 Jan 2018 05:29:09 -0800 (PST) Received: from dhcp-135-24-192-142.localdomain ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id 68sm12588733pfx.186.2018.01.05.05.29.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 05:29:08 -0800 (PST) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, Shivasharan S Subject: [PATCH 01/14] megaraid_sas: zero out IOC INIT and stream detection memory Date: Fri, 5 Jan 2018 05:27:36 -0800 Message-Id: <1515158869-26693-2-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1515158869-26693-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1515158869-26693-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> 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 Memory allocated for IOC_INIT command and stream detection array are not zero'd before using. Use kzalloc instead of kmalloc to zero out the memory allocated. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index cc54bdb5c712..ed106cbd4440 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5387,7 +5387,7 @@ static int megasas_init_fw(struct megasas_instance *instance) } for (i = 0; i < MAX_LOGICAL_DRIVES_EXT; ++i) { fusion->stream_detect_by_ld[i] = - kmalloc(sizeof(struct LD_STREAM_DETECT), + kzalloc(sizeof(struct LD_STREAM_DETECT), GFP_KERNEL); if (!fusion->stream_detect_by_ld[i]) { dev_err(&instance->pdev->dev, diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 65dc4fea6352..0d6d4dedad62 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1603,7 +1603,7 @@ static int megasas_alloc_ioc_init_frame(struct megasas_instance *instance) fusion = instance->ctrl_context; - cmd = kmalloc(sizeof(struct megasas_cmd), GFP_KERNEL); + cmd = kzalloc(sizeof(struct megasas_cmd), GFP_KERNEL); if (!cmd) { dev_err(&instance->pdev->dev, "Failed from func: %s line: %d\n",