Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp4093945rdg; Wed, 18 Oct 2023 15:04:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXImXk8JCd1ndhWTAl6N3JKDbkzz6uWHnSBL7G1woj9u+UdON8H/1cYfidNHnCvktHassh X-Received: by 2002:a05:6358:c69a:b0:166:e391:cd0c with SMTP id fe26-20020a056358c69a00b00166e391cd0cmr283212rwb.6.1697666682226; Wed, 18 Oct 2023 15:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697666682; cv=none; d=google.com; s=arc-20160816; b=IaVzata6MeM9Sh8+ZaTv5q/+I8AOXguqjBfNJ8/DypUJvnSSelB52UqW4kK5Q3+hPC CcnZJKkA2vVISubnN7FaPppRGYXLIq9ReKGfjBGoKeTp/GzEjsG305SXLHzD9uShKB7T WJ3pz5Gk/KYSksNeh2aFE5ebzriAnrC07IPei80ei8Sdxasemh1agmBHn9kEi22o2qsz /4LAl7ELwNbnG+Q4AKjEhHjtGHEZbbpioW+GphnVMAjoSYqo/3ncVsbFiX/CVKkM9l2U 8/b0mWNVlnrYsJ8ApNXlnBSMSKiEofwVpQbt7IJx/d69QPv5/jYVN5C+N58sgG/EPVqF WTnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=2s3U1yAkM0di0yOCxQzp2ytWG3Emh1ypqTY1EYO4mxw=; fh=iV5oZSBAobDF9z4179jgPjHbqgMPVeFdpzyMTF2Q9qs=; b=NNa1W3ACYWQJWUsN3ycLejehE7AjrMlgNp7W8XuKHPXXOveeOUtpKARudXveQXRjrj JodTY1VKK8/c8mVugzeM+SSE/pyb/HF9Pjx08e82PXngK61G/vUGm3R/z1kM9mqqEIh3 HoBX13ABdiqxjS/13qk4x5iag4pZrIa8TVwxZmQ/kGs6WgMXDtnOAKSRjf5F3dT3IqlC niZ1pC3D+wZhzYvFI7AfvDjNeE4hnzcxZk8nPI1PfUeE8elDWJ+zx3EdrBm600gP8/cH nOdyq5Bw5qITpgOceTZSYKSFV63RJ4zyK6mne9yOLT3o1gs2IUNAXmmM3MWZV8GpsOQ8 j5yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=s1UMVl3c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id x27-20020aa78f1b000000b006b28fa70b48si4661294pfr.354.2023.10.18.15.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 15:04:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=s1UMVl3c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 31576809B9CB; Wed, 18 Oct 2023 15:04:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231373AbjJRWEQ (ORCPT + 99 others); Wed, 18 Oct 2023 18:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229721AbjJRWEP (ORCPT ); Wed, 18 Oct 2023 18:04:15 -0400 Received: from out-205.mta0.migadu.com (out-205.mta0.migadu.com [91.218.175.205]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C6AF10F for ; Wed, 18 Oct 2023 15:04:13 -0700 (PDT) Date: Wed, 18 Oct 2023 18:04:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697666651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2s3U1yAkM0di0yOCxQzp2ytWG3Emh1ypqTY1EYO4mxw=; b=s1UMVl3cbdUUtkb57UUvuFyq4GhP0cIIbcrHXN/hjQSZ2ymQwfVvzpXbJQZ2G90Ex+DldY TT4ybtNZhgETfTVatkwg6v/+EhdN1E0i1zmDhyWdg5Y46EHh0KpwMwFpDXINvBF7qTsnF0 6yNmfX0ieuecgs8Po7tHkg9dWk4NVGU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Kees Cook Cc: Brian Foster , linux-bcachefs@vger.kernel.org, kernel test robot , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] bcachefs: Refactor bkey_i to use a flexible array Message-ID: <20231018220407.b5dvm2ehibcqvhzq@moria.home.lan> References: <20231010235609.work.594-kees@kernel.org> <202310131637.D0C66BFBA@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202310131637.D0C66BFBA@keescook> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 18 Oct 2023 15:04:28 -0700 (PDT) On Fri, Oct 13, 2023 at 04:44:21PM -0700, Kees Cook wrote: > On Fri, Oct 13, 2023 at 07:26:11AM -0400, Brian Foster wrote: > > Hi Kees, > > > > I'm curious if this is something that could be buried in bch_val given > > it's already kind of a fake structure..? If not, my only nitty comment > > I was thinking it would be best to keep the flexible array has "high" in > the struct as possible, as in the future more refactoring will be needed > to avoid having flex arrays overlap with other members in composite > structures. So instead of pushing into bch_val, I left it at the highest > level possible, bch_i, as that's the struct being used by the memcpy(). I agree with Brian here - I'd like this buried in bch_val, if possible. I also went with unsafe_memcpy() for now - that's now in my for-next tree. I'm not seeing any advantage of DECLARE_FLEX_ARRAY over that - perhaps later if we could use __counted_by that would make more sense.