From patchwork Thu Oct 29 21:51:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7521341 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 45D8B9F327 for ; Thu, 29 Oct 2015 21:52:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6AB68207BB for ; Thu, 29 Oct 2015 21:51:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 653A1207B5 for ; Thu, 29 Oct 2015 21:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756991AbbJ2Vv6 (ORCPT ); Thu, 29 Oct 2015 17:51:58 -0400 Received: from mail-lf0-f49.google.com ([209.85.215.49]:36778 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753748AbbJ2Vv5 (ORCPT ); Thu, 29 Oct 2015 17:51:57 -0400 Received: by lffz202 with SMTP id z202so25116889lff.3 for ; Thu, 29 Oct 2015 14:51:56 -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=0ax/9qmZsAgGJflYlpWjLl5E65I7DX8wfUV3nrUcWac=; b=BWD+jUbISP7/yt1yUBEz8qbf+ADP52SkBIUvNnxuTkTTWBdsSU1z4jxhdkIZ2y2YE/ PFDAXSf41eEeuh/KLjdf+xXBmMRZNaLTr3n0uc1jjqFHu/FcIiNcRM8GNoINWLWgkAee bkacpNXRWIzXjUXs1tL8JqlCUoa2fcbktVukcNveRyzLwYLKuINiqAwCPb8/78Kq/U25 qamcFQZ7YNGjiRojWBN0JqwT6qaQbjX6oq/GrTvKZdt4FgCPJugFvUZtHBEQ6u7xTf3X 5wItsE0hNsIB7sRnW9aK9MIojM3FM8TWkENwxr4ryZ0fDi89J6f+VF9OnwhUQwacuVFo hvCg== 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=0ax/9qmZsAgGJflYlpWjLl5E65I7DX8wfUV3nrUcWac=; b=CS4g2cpbPomVhT3sDMWO+GMxbTO7zsbb2tDmBypxfl0Cx+eLXRmfar8GMTkWJW3CDS y7RVPRgRwZn7BoekXYHKxhYYKTF4ZxsetM6tHSfJSuejH0cvVfdSX5Dbc86gejdk7qM2 FPElnjx0nlV511ltDh8PWmp57UiaY5UAHEvLxE0XdbCvmajdoXo9yYLo9JEJ25eA9Yzi Q0kwd540gbbLtROVLhpSluImw3qu3sulVr2WAfsVZfnEqjD8LYmJqzNC1BOQ1dZX9lq2 bGCxkd8O9Tzm0Li8PEMoKxKoye55nNZorafbqoi0dAAyo7zSQyDTFnQNd1XTqUdOmuFI NC2Q== X-Gm-Message-State: ALoCoQlaTFdHWSoQ4OcJlFj7pEIO8iz2HLVIkeyVX/FLm+Cu7yJyoS0tQJN2Mu89pTYy9wFNswLU X-Received: by 10.25.20.24 with SMTP id k24mr1439732lfi.117.1446155515911; Thu, 29 Oct 2015 14:51:55 -0700 (PDT) Received: from wasted.cogentembedded.com ([83.149.8.132]) by smtp.gmail.com with ESMTPSA id pm6sm683397lbc.1.2015.10.29.14.51.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Oct 2015 14:51:55 -0700 (PDT) From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH 1/2] sh_eth: fix uninitialized arrays in sh_eth_ring_init() Date: Fri, 30 Oct 2015 00:51:52 +0300 Message-ID: <6300720.GXPplNSh3O@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.2.3-200.fc22.x86_64; KDE/4.14.11; x86_64; ; ) In-Reply-To: <5844359.Wmo6777QiE@wasted.cogentembedded.com> References: <5844359.Wmo6777QiE@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=-6.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_WEB,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 by sh_eth_private::[rt]x_skbuff to be initialized with NULLs but they are allocated with just kmalloc_array() and so left filled with random data. Use kcalloc() instead. Signed-off-by: Sergei Shtylyov --- 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;