Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4675706rwd; Tue, 23 May 2023 10:47:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7uOvtImiJzCHV3ebq5d//LSBNDBu52DVo/oKglGb6etRlcwPA80hszbhtDZpuWtO8sRjl6 X-Received: by 2002:a17:903:11c9:b0:1aa:ff41:31a7 with SMTP id q9-20020a17090311c900b001aaff4131a7mr17332604plh.13.1684864057931; Tue, 23 May 2023 10:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684864057; cv=none; d=google.com; s=arc-20160816; b=cv6LfxWiLMMGTIYW+sQipDjDMaY393xwXH/cquXWzZqvQ/pT4P3FJXNU7hkmc/aPns 45+CvQ7SMGwCsEQ1VkxO3JH45dG1R4ecRDqBaUkLm1y+FnBi1o2UnunOEe0H0+ZO1LYw Ctk/YAgH+UhfebxOCFoUzir+RfXUr3QtQA4BbyslayoGZHDlTMwMvUU9Du5toGAPv2bT N+6gxzEtY5sYcq1jIn/UJEVXn/SzDtrdS2/eL81xZfz3Zk18UmQBxYZIBSz1GKH40H/C GgvrkBlyDFAZOzuxzi/2rMxdMaUY2bxY77rxE0SjKIOH1BHDV4I+QpAb3y3VXhmxN3F0 Wo1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ucRqYi9w2ohGcO+Pu5J06hiT3qMkP+32yPno1DiUtoI=; b=iDMlqgbp9ZYLz9qwYepjVKaYnLSA/Kz82qEo7oM1BUbUNX7QH4vj6y5jH6EyUPk/JS I1/6UkG+D74OvdSpHY8tHCmysxmf9y9VcUTyLqeOl0/nSSZLh0lOoDepMsfA9wrYqTFq lTYuIJDdViUt5hsQQDbG2zDg6EsZzPLFq30PmtBnrc4Y9tl/739laLsijKQZA/Dcp+FW t3YiLsjxQeyYyS5Qiy2N5GqLZCVnPoTIbYIsju/RngaNw/5TsroS/oVjQAM7a/P5Y9mn 5kMFuBRrZ4F5OH571qYy42nOrQ9BX4z+JGx3JWQOMUPCL7T7+nWPMsgskbuClLIxnGSS zTnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P1G5Bggf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a170902f7d600b001ab18790b0fsi6732108plw.95.2023.05.23.10.47.25; Tue, 23 May 2023 10:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P1G5Bggf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238255AbjEWRoP (ORCPT + 99 others); Tue, 23 May 2023 13:44:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237501AbjEWRoM (ORCPT ); Tue, 23 May 2023 13:44:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6988490; Tue, 23 May 2023 10:44:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EE0756355A; Tue, 23 May 2023 17:44:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59C74C4339B; Tue, 23 May 2023 17:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684863846; bh=rFkmvkO0OpsALLfe8oNx4FG/ovMg2iAu1RwUUNxXPOk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=P1G5Bggfei3jyT4cBhkFKbGmpWhjxNa6mc9jYXeQzxNn8WmCrcdc+HCKddBnO8mUP sShp2kKTJk6gWyhVLLCdl16VvhUUnhqim+omtCICUtyA+A+A7P12Cl/Tu3EKXHKmXU RacbOqavhH0QMZYR5BiNbc7yWqtj1fJYD+RImi0DGtKlAqcuFyOa2tQdjlHKfpEDIl i6DRD2DcNw18izG2+a1yMpBViqbBd7SQw0bdfGVP+vCXHaU2Bq6SA6vqe0o93GwoIN NgHMlUDmjmuvr7x0VB2tF52q5uwaZXTR0zxOlo1npN42vPW06a7kfqBM3EJ0yM6Ot+ Ritn8eeVXa0dA== Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-4f3b39cea1eso163440e87.3; Tue, 23 May 2023 10:44:06 -0700 (PDT) X-Gm-Message-State: AC+VfDxMVLAdYpYfsZSHmuI5gZOvVmhsYT6O1vQ0aiO/l+TRkmhM2jnP d4EYVdpJEqL1+f1bRkO5LtTQEJmekMeAl0totVE= X-Received: by 2002:a05:6512:922:b0:4eb:1361:895c with SMTP id f2-20020a056512092200b004eb1361895cmr5457525lft.55.1684863844325; Tue, 23 May 2023 10:44:04 -0700 (PDT) MIME-Version: 1.0 References: <20230522212114.gonna.589-kees@kernel.org> In-Reply-To: <20230522212114.gonna.589-kees@kernel.org> From: Song Liu Date: Tue, 23 May 2023 10:43:52 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] md/raid5: Convert stripe_head's "dev" to flexible array member To: Kees Cook Cc: Christoph Hellwig , linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 22, 2023 at 2:21=E2=80=AFPM Kees Cook w= rote: > > Replace old-style 1-element array of "dev" in struct stripe_head with > modern C99 flexible array. In the future, we can additionally annotate > it with the run-time size, found in the "disks" member. > > Cc: Christoph Hellwig > Cc: linux-raid@vger.kernel.org > Signed-off-by: Kees Cook > --- > It looks like this memory calculation: > > memory =3D conf->min_nr_stripes * (sizeof(struct stripe_head) + > max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; > > ... was already buggy (i.e. it included the single "dev" bytes in the > result). However, I'm not entirely sure if that is the right analysis, > since "dev" is not related to struct bio nor PAGE_SIZE? > > v1: https://lore.kernel.org/all/20230517233313.never.130-kees@kernel.org/ > v2: use new struct_size_t() helper from > https://lore.kernel.org/lkml/20230522211810.never.421-kees@kernel.org= / LTGM. Thanks! I will hold this for a while until struct_size_t() merged. Song