From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752232AbcHHNEh (ORCPT ); Mon, 8 Aug 2016 09:04:37 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:33511 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750916AbcHHNEf (ORCPT ); Mon, 8 Aug 2016 09:04:35 -0400 Subject: Re: [RFC PATCH 1/3] net: Remove unnecessary memset in __snmp6_fill_stats64 To: Florian Westphal References: <1470651742-15195-1-git-send-email-hejianet@gmail.com> <1470651742-15195-2-git-send-email-hejianet@gmail.com> <20160808111231.GA20192@breakpoint.cc> Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy From: hejianet Message-ID: Date: Mon, 8 Aug 2016 21:04:09 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160808111231.GA20192@breakpoint.cc> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yes, sorry about it,I am too hasty B.R. Jia He On 8/8/16 7:12 PM, Florian Westphal wrote: > Jia He wrote: >> buff[] will be assigned later, so memset is not necessary. >> >> Signed-off-by: Jia He >> Cc: "David S. Miller" >> Cc: Alexey Kuznetsov >> Cc: James Morris >> Cc: Hideaki YOSHIFUJI >> Cc: Patrick McHardy >> --- >> net/ipv6/addrconf.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c >> index ab3e796..43fa8d0 100644 >> --- a/net/ipv6/addrconf.c >> +++ b/net/ipv6/addrconf.c >> @@ -4967,7 +4967,6 @@ static inline void __snmp6_fill_stats64(u64 *stats, void __percpu *mib, >> >> BUG_ON(pad < 0); >> >> - memset(buff, 0, sizeof(buff)); >> buff[0] = IPSTATS_MIB_MAX; >> >> for_each_possible_cpu(c) { > for (i = 1; i < IPSTATS_MIB_MAX; i++) > buff[i] += snmp_get_cpu_field64(mib, c, i, syncpoff); > > Without memset result of buff[i] += ... is undefined. >