From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751338AbdBHT6X (ORCPT ); Wed, 8 Feb 2017 14:58:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35654 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbdBHT6T (ORCPT ); Wed, 8 Feb 2017 14:58:19 -0500 Date: Wed, 8 Feb 2017 17:46:57 -0200 From: Arnaldo Carvalho de Melo To: Alexei Starovoitov Cc: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , linux-kernel@vger.kernel.org, Daniel Borkmann , "David S . Miller" , netdev@vger.kernel.org, Shuah Khan Subject: Re: [PATCH net-next v3 04/11] bpf: Use bpf_load_program() from the library Message-ID: <20170208194657.GC2162@redhat.com> References: <20170207214500.27496-1-mic@digikod.net> <20170207214500.27496-5-mic@digikod.net> <589A5597.7090107@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <589A5597.7090107@fb.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 08 Feb 2017 19:47:01 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Feb 07, 2017 at 03:17:43PM -0800, Alexei Starovoitov escreveu: > On 2/7/17 1:44 PM, Mickaël Salaün wrote: > >- union bpf_attr attr; > >+ union bpf_attr attr = {}; > > > >- bzero(&attr, sizeof(attr)); > > I think somebody mentioned that there are compilers out there > that don't do it correctly, hence it was done with explicit bzero. > Arnaldo, Wang, do you remember the details? https://www.spinics.net/lists/netdev/msg411144.html But this was when some named initializers are used in a union with unnamed members like 'union bpf_attr', unsure if this would break with the above case where no named initializers are being used. Having that said, the above is gratuitous, the code that is being replaced is not related to the patch at hand, and conceptually the end result should be the same. So, please, just leave it as is, i.e. using bzero() and make your patch a bit smaller, remember, small is good, smaller is even better ;-) - Arnaldo