From patchwork Fri Oct 30 23:05:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7529901 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6CAE39F2F7 for ; Fri, 30 Oct 2015 23:06:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E4AE204EB for ; Fri, 30 Oct 2015 23:06:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D54F204D5 for ; Fri, 30 Oct 2015 23:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759637AbbJ3XGA (ORCPT ); Fri, 30 Oct 2015 19:06:00 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:35989 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752495AbbJ3XF7 (ORCPT ); Fri, 30 Oct 2015 19:05:59 -0400 Received: by lffz202 with SMTP id z202so41761187lff.3 for ; Fri, 30 Oct 2015 16:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding :content-type; bh=WRwyO2X3N7Ojn+6g2m5MRddphtctrUwF/H6hMGSg5pA=; b=rfeOB2Q8OYzhNtYiLmOgSrM9AyfcDAU/fpXRL0G0anvTOcgUzM2Tv10b2llYZZGxZA ig1JQRHjvCZyvlec67zoZ9Ckrb4X3SCv0VCjKc8aGKhKfVBQsTkTOlRiV7uxMHm9Rfg6 zTUjj+1KyrreMgtzg4D09mV5fvRa68wsRBcs06K3kymyNCMzZXfus4TttG051hGq7nX3 EwE861jlUVXs3JppWHCSok3G6TKJBfvODWdrzjCWcd3+bFR4rw5IoICRvOiiXTkMaqtF iPEmQUIEJWXSCKJhG+VuLgsVC3jDBEdNFxbtYYHGw9ImQ+l+lS7CwVaF0RjJaFCf6TWh thoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=WRwyO2X3N7Ojn+6g2m5MRddphtctrUwF/H6hMGSg5pA=; b=Ckq6xSSO5rOn540W/8GLnMAXvS8I/ltOkwCYAPgFNW5bxyreHWl9WjymZmS3IxLl0C RBaOXDmmApo4dRXwJzmzu4KWHIhtL/uKHXph9PnmNZxQraU7cf/O+f7zGKeyAqsn2xge CvnkjUD9cpzDO0L+7EoBnexJ/SUYhmex9+sMOYMGUgVxBS52vEBgxk+Vq1bnYRuMeZW7 pLuaWOK0ZZ+8DEDKHbXazCDCtaFqX6Ypcad+e9xN0IW66vlQmP5YvDSYKWZcJeqA6YbQ tBKZdB3IPFWV3Xk9ArVDvZhqfV2DpTzj7pmOP+eywuH4J5Cu8gwtAw2rP4OmLRGMsvxk 2kpQ== X-Gm-Message-State: ALoCoQm0m52AyWMitEYbQKw94Y9qGgxH/fysTN2VYph09LdTqPMq+CDGBtAgLEgrGhnrWsaXfyYl X-Received: by 10.25.91.19 with SMTP id p19mr3421616lfb.35.1446246357825; Fri, 30 Oct 2015 16:05:57 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.80.141]) by smtp.gmail.com with ESMTPSA id m17sm1666001lfb.16.2015.10.30.16.05.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Oct 2015 16:05:57 -0700 (PDT) From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH v2 1/2] sh_eth: fix uninitialized arrays in sh_eth_ring_init() Date: Sat, 31 Oct 2015 02:05:56 +0300 Message-ID: <3283850.HAForN0Wed@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.1.8-100.fc21.x86_64; KDE/4.14.11; x86_64; ; ) In-Reply-To: <3291270.dPgp9opalf@wasted.cogentembedded.com> References: <3291270.dPgp9opalf@wasted.cogentembedded.com> MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 sh_eth_ring_free() called in the sh_eth_ring_init()'s error path expects the arrays pointed to by 'sh_eth_private::[rt]x_skbuff' to be initialized with NULLs but they are allocated with just kmalloc_array() and so are left filled with random data. Use kcalloc() instead. Signed-off-by: Sergei Shtylyov --- Changes in version 2: - fixed grammar in the change log reformatting it. drivers/net/ethernet/renesas/sh_eth.c | 8 ++++---- drivers/net/ethernet/renesas/sh_eth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net/drivers/net/ethernet/renesas/sh_eth.c @@ -1212,15 +1212,15 @@ static int sh_eth_ring_init(struct net_d mdp->rx_buf_sz += NET_IP_ALIGN; /* Allocate RX and TX skb rings */ - mdp->rx_skbuff = kmalloc_array(mdp->num_rx_ring, - sizeof(*mdp->rx_skbuff), GFP_KERNEL); + mdp->rx_skbuff = kcalloc(mdp->num_rx_ring, sizeof(*mdp->rx_skbuff), + GFP_KERNEL); if (!mdp->rx_skbuff) { ret = -ENOMEM; return ret; } - mdp->tx_skbuff = kmalloc_array(mdp->num_tx_ring, - sizeof(*mdp->tx_skbuff), GFP_KERNEL); + mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff), + GFP_KERNEL); if (!mdp->tx_skbuff) { ret = -ENOMEM; goto skb_ring_free;