From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0050CC47247 for ; Fri, 8 May 2020 13:13:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CCB3C24999 for ; Fri, 8 May 2020 13:13:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588943601; bh=WnmcXTXsiT6QBqU7y2rKUaAHDFDo3K4E7Fg5YW5WJIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dLDPQQDcQokz1V+awI+ToJDp+3MwdsdMcr4/pT8l8GCoiWIPVcihOhrmoaFuI3mU6 PsiVbu88togSPflwf9IxP1zdSAwjgXEgrMbMMKPOpvof2O2lrA59RS9cyYu80W/CnB dWGAv9OD26KECo2JOjqSzXr2P/TsdbbI9PGT6Vvc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728914AbgEHNNV (ORCPT ); Fri, 8 May 2020 09:13:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:51234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729618AbgEHMsB (ORCPT ); Fri, 8 May 2020 08:48:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E2F732145D; Fri, 8 May 2020 12:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942081; bh=WnmcXTXsiT6QBqU7y2rKUaAHDFDo3K4E7Fg5YW5WJIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=klN4SmQZnuJF3Gt5pkp9YxGUUArkVF3UM1+cHskDD7LbetphspmN0x4E+choELnTd EyyDpkbnGG5kYdBqGSmv4Jo71gGSBy1VIrx0sJw9KD+LJ4JK8Pb00UDe+/2oYyhBG0 v043nZOD0jpcBUIkhz596/HuldcuX6bMRfAoCxTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , "David S. Miller" Subject: [PATCH 4.4 290/312] mvpp2: use correct size for memset Date: Fri, 8 May 2020 14:34:41 +0200 Message-Id: <20200508123144.777181962@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123124.574959822@linuxfoundation.org> References: <20200508123124.574959822@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit e8f967c3d88489fc1562a31d4e44d905ac1d3aff upstream. gcc-7 detects a short memset in mvpp2, introduced in the original merge of the driver: drivers/net/ethernet/marvell/mvpp2.c: In function 'mvpp2_cls_init': drivers/net/ethernet/marvell/mvpp2.c:3296:2: error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size] The result seems to be that we write uninitialized data into the flow table registers, although we did not get any warning about that uninitialized data usage. Using sizeof() lets us initialize then entire array instead. Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/marvell/mvpp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -3305,7 +3305,7 @@ static void mvpp2_cls_init(struct mvpp2 mvpp2_write(priv, MVPP2_CLS_MODE_REG, MVPP2_CLS_MODE_ACTIVE_MASK); /* Clear classifier flow table */ - memset(&fe.data, 0, MVPP2_CLS_FLOWS_TBL_DATA_WORDS); + memset(&fe.data, 0, sizeof(fe.data)); for (index = 0; index < MVPP2_CLS_FLOWS_TBL_SIZE; index++) { fe.index = index; mvpp2_cls_flow_write(priv, &fe);