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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 652E0C433F5 for ; Thu, 5 May 2022 19:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385149AbiEETgO (ORCPT ); Thu, 5 May 2022 15:36:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385131AbiEETgB (ORCPT ); Thu, 5 May 2022 15:36:01 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13C505C653 for ; Thu, 5 May 2022 12:32:20 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id e24so5087617pjt.2 for ; Thu, 05 May 2022 12:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EOewjZKogNzEx9zFkxTiwVeX9O73E8+rxUrKCGLnZxg=; b=TgYp87XeMuHw4kfuuIYKyJ5xg3Bf+EBlgFpOVZz9+/0BPs+Z6azVvmnOICk6zx2eTE tczIFjF07XtN/n9uGmSnmZf+pbPbkOzW9u24HVcBrKjfFRAXW8suN/eYiFsQiaSTDjAj AGDsgPRlkyLVEDH7ZM2ezggNxFIlqaWFz6sF8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EOewjZKogNzEx9zFkxTiwVeX9O73E8+rxUrKCGLnZxg=; b=TynbnUUrVu8hK0Mh8DVDAncThr9RwLQh9/IsHpKAh9rJz71I3eQHVQNJcpj3PkkI9m K/bFWCutcNBwstDoW5OjYRXw4uBorMoF02l82gVPCGQFq9UeUfdG1j8HHwMJzoRz8ax4 JtcvdOFtttaK7A6ItES73fddzhn0RvWJZCwikwFW3IFlHHHvIw8KRHYVRsk/edcKozwW ybG3z7DvNOlP0DE8rqYycZvapQ0nT42OdPv2tXs+tMvoTWqagogPHfkBOK6rRXBBandW 4BfBgzmjmM8tc6vOIViJhImfsWV65B+ymIusj7RBGoYXAAB09GwW9bW4UwajOam10jiC HyeA== X-Gm-Message-State: AOAM5309BOUxNsmYw4X48IpgOztgeefIlbmzNMao5rH+FOHZsnVG89oy X8v08HZ+VuiHkhIhjvTWD+05LA== X-Google-Smtp-Source: ABdhPJyYVTC3IlPABWaYFjuUxUPmftJikWm0tSMiHJQXGEPyNPhTGmOnvVXhpQMvhvSdSnY3GHaMBA== X-Received: by 2002:a17:90b:388b:b0:1dc:515e:1b0c with SMTP id mu11-20020a17090b388b00b001dc515e1b0cmr8065877pjb.224.1651779139576; Thu, 05 May 2022 12:32:19 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n11-20020a170903404b00b0015e8d4eb250sm1889338pla.154.2022.05.05.12.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 12:32:19 -0700 (PDT) Date: Thu, 5 May 2022 12:32:18 -0700 From: Kees Cook To: Keith Packard Cc: Johannes Berg , "Gustavo A . R . Silva" , Francis Laniel , Daniel Axtens , Dan Williams , Vincenzo Frascino , Guenter Roeck , Daniel Vetter , Tadeusz Struk , Alexei Starovoitov , alsa-devel@alsa-project.org, Al Viro , Andrew Gabbasov , Andrew Morton , Andy Gross , Andy Lavr , Arend van Spriel , Baowen Zheng , Bjorn Andersson , Boris Ostrovsky , Bradley Grove , brcm80211-dev-list.pdl@broadcom.com, Christian Brauner , Christian =?iso-8859-1?Q?G=F6ttsche?= , Christian Lamparter , Chris Zankel , Cong Wang , David Gow , David Howells , "David S. Miller" , Dennis Dalessandro , devicetree@vger.kernel.org, Dexuan Cui , Dmitry Kasatkin , Eli Cohen , Eric Dumazet , Eric Paris , Eugeniu Rosca , Felipe Balbi , Frank Rowand , Franky Lin , Greg Kroah-Hartman , Gregory Greenman , Haiyang Zhang , Hante Meuleman , Herbert Xu , Hulk Robot , Jakub Kicinski , "James E.J. Bottomley" , James Morris , Jarkko Sakkinen , Jaroslav Kysela , Jason Gunthorpe , Jens Axboe , Johan Hedberg , John Keeping , Juergen Gross , Kalle Valo , keyrings@vger.kernel.org, kunit-dev@googlegroups.com, Kuniyuki Iwashima , "K. Y. Srinivasan" , Lars-Peter Clausen , Lee Jones , Leon Romanovsky , Liam Girdwood , linux1394-devel@lists.sourceforge.net, linux-afs@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-hardening@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-integrity@vger.kernel.org, linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org, linux-security-module@vger.kernel.org, linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, linux-xtensa@linux-xtensa.org, llvm@lists.linux.dev, Loic Poulain , Louis Peens , Luca Coelho , Luiz Augusto von Dentz , Marc Dionne , Marcel Holtmann , Mark Brown , "Martin K. Petersen" , Max Filippov , Mimi Zohar , Muchun Song , Nathan Chancellor , netdev@vger.kernel.org, Nick Desaulniers , Nuno =?iso-8859-1?Q?S=E1?= , Paolo Abeni , Paul Moore , Rich Felker , Rob Herring , Russell King , selinux@vger.kernel.org, "Serge E. Hallyn" , SHA-cyfmac-dev-list@infineon.com, Simon Horman , Stefano Stabellini , Stefan Richter , Steffen Klassert , Stephen Hemminger , Stephen Smalley , Takashi Iwai , Tom Rix , Udipto Goswami , wcn36xx@lists.infradead.org, Wei Liu , xen-devel@lists.xenproject.org, Xiu Jianfeng , Yang Yingliang Subject: Re: [PATCH 02/32] Introduce flexible array struct memcpy() helpers Message-ID: <202205051228.4D5B8CD624@keescook> References: <20220504014440.3697851-1-keescook@chromium.org> <20220504014440.3697851-3-keescook@chromium.org> <202205040819.DEA70BD@keescook> <970a674df04271b5fd1971b495c6b11a996c20c2.camel@sipsolutions.net> <871qx8qabo.fsf@keithp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871qx8qabo.fsf@keithp.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Thu, May 05, 2022 at 08:16:11AM -0700, Keith Packard wrote: > Johannes Berg writes: > > > Yeah, dunno, I guess I'm slightly more on the side of not requiring it, > > since we don't do the same for kmalloc() etc. and probably really > > wouldn't want to add kmalloc_s() that does it ;-) > > I suspect the number of bugs this catches will be small, but they'll be > in places where the flow of control is complicated. What we want is to > know that there's no "real" value already present. I'd love it if we > could make the macro declare a new name (yeah, I know, mixing > declarations and code). I don't think I can do a declaration and an expression statement at the same time with different scopes, but that would be kind of cool. We did just move to c11 to gain the in-loop iterator declarations... > Of course, we could also end up with people writing a wrapping macro > that sets the variable to NULL before invoking the underlying macro... I hope it won't come to that! :) -- Kees Cook