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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 32FD7C2BA12 for ; Thu, 2 Apr 2020 20:04:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 004A620737 for ; Thu, 2 Apr 2020 20:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585857885; bh=SLau+LKmZYm2Wl1sqETl68Y6B4wiD4ofzcVkxfGGCxg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=zLETLyAPCUgBCfpBwOTiQAa9Ne8yz+rvRP43ffV9hamjnvkrWGJLUckWV7dJpwrSR PFb/HqdjLy77J+OxgmJrv+VizEcA+EV7MI3Br6wYrbIPtoq5CrCPFQjgDdGiD3M+3a jrt9U7ZU+CNG5eboMYyyZVefNiCK3p+43qSwguJE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388888AbgDBUEn (ORCPT ); Thu, 2 Apr 2020 16:04:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:58204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388781AbgDBUEn (ORCPT ); Thu, 2 Apr 2020 16:04:43 -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 D95EC206E9; Thu, 2 Apr 2020 20:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585857881; bh=SLau+LKmZYm2Wl1sqETl68Y6B4wiD4ofzcVkxfGGCxg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kS2l3M9Z21CypL26NC8ZFD56/5M2Imd9mOvSze8VhnzIW42lVdcInG0Y6YOLt6o3O X1i7VfWrX0gvQdaL78DUzkqahMxXEfAhTTcrX5sYoL9VmRMtU2WJx120EnX0ZOKHhw B7a2CODcDREViM/pGwbiWjB3Xha/t+WlfXlC2Tao= Date: Thu, 2 Apr 2020 22:04:37 +0200 From: Greg Kroah-Hartman To: Pavel Machek Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Maciej =?utf-8?Q?=C5=BBenczykowski?= , John Stultz , Alexander Potapenko , Alistair Delva , Daniel Borkmann , Yonghong Song Subject: Re: [PATCH 4.19 105/116] bpf: Explicitly memset the bpf_attr structure Message-ID: <20200402200437.GA3251457@kroah.com> References: <20200401161542.669484650@linuxfoundation.org> <20200401161555.630698707@linuxfoundation.org> <20200402185320.GA8077@duo.ucw.cz> <20200402192053.GB3243295@kroah.com> <20200402195324.GB8077@duo.ucw.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200402195324.GB8077@duo.ucw.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 02, 2020 at 09:53:24PM +0200, Pavel Machek wrote: > Hi! > > > > Should we fix gcc, instead? > > > > Also, this is allowed in the C standard, and both clang and gcc > > sometimes emit code that does not clear padding in structures. Changing > > the compiler to not do this would be wonderful, but we still have to > > live with this for the next 10 years as those older compilers age-out. > > I agree C standard allows this. It allows to even worse stuff. > > I was just surprised that gcc does that.. and that I did not know > about this trap. I was probably telling people to do = {} for > structure init... > > Should we get "= {}" warning for checkpatch? Only if the structure has padding, and it is data to be sent to userspace, or to be intrepreted in a way from userspace. Good luck trying to write a checkpatch rule for that. greg k-h