Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2650123rwd; Wed, 17 May 2023 12:26:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6FuiCqcCP0nPMFx2XDj82yu3IsFbcSIPZTPHLO/goL6LT/lswSfSiIgnFYLntTfQLvP8Vq X-Received: by 2002:a17:902:a604:b0:1ac:b363:83b3 with SMTP id u4-20020a170902a60400b001acb36383b3mr25421988plq.41.1684351606373; Wed, 17 May 2023 12:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684351606; cv=none; d=google.com; s=arc-20160816; b=Pu6bnJIfSU/fp0URZd2TvvVNdx73z/UELdEOxnmv7HuCT2VpdNHOlIpevWTsIph6j2 kfTdGYdXelkGaPFENFtYptG3yeFHX4Ag0WbOFX1z6WUevP1kKvJbFDHDpnqflthVtZND hH+00AUly68ugfmJZixCfSHRU21kBspzaluG0HdX+SpOjbvmfDB38lEhbfWZSRP8iEba RwTODGH9Ouzao5hcrOdXSjAcKCtTHhiqEDROy2VZ77YZ9jHDxMyho39gheSEoXJi10wj TM3eGcYHeRNa60ntvqNS69N8Pwp2zp17e2awtFTetGBc09Ft+PFgZD/mpd4JVpSNG6+A drbg== 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:date:dkim-signature; bh=2TweVo7pe1RT0U4fJi1MmEd78Di3WvMfNoLR23I7nbs=; b=W5x51Ilc/zrNRESCqYvYUUjxdxgTj80xfnfR73/kypMXyaUl8j2g3NNTG5EKFkXIrv O8yzlPjIvRS31x8bkpehYcOeO9qfla+xUopWtE58gBIkMrnK7EYPuE/feSXXwE2NUfcO 5xfAgBXOeC+wI7Y7yTytbmlDIpdcN6KKrtQ3IY89a6u0psBO0j8sQUUZBW/DDNbwKw/B HVFJ2tUGGek7Sdon/bHd+pl+gmFgvA4B69YKNzZ1qadB0vN74j8cy/EKcxwYRFaODiII KmHd2dSRcnHZGQsNiNNKtfFsJIcSej0wuE2tVipB1SBTimmhSRgg6tZ8FX/Hy1XcETFz wN7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lbYAiBBR; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a170902dac600b001ab13016a76si23699909plx.601.2023.05.17.12.26.34; Wed, 17 May 2023 12:26:46 -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=@chromium.org header.s=google header.b=lbYAiBBR; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbjEQTM3 (ORCPT + 99 others); Wed, 17 May 2023 15:12:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbjEQTM1 (ORCPT ); Wed, 17 May 2023 15:12:27 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D81CA255 for ; Wed, 17 May 2023 12:12:13 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1ae52ce3250so10175235ad.2 for ; Wed, 17 May 2023 12:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684350732; x=1686942732; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=2TweVo7pe1RT0U4fJi1MmEd78Di3WvMfNoLR23I7nbs=; b=lbYAiBBRmL5JG7kvR3ch5RRhu+skJcHwpvcGTQun5EtQJEpcQC3jTxCTGQOM3dVW8X CrEjomYR2sZtOYw2xbyl9tOqhSYF/zT86dd11oD3tjkwXgF0T+QbRmX+4Bqihn7a/Yqh gkQW0IJ+k9LTKm7tT9O4BR/ogticSCt2HQ3+c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684350732; x=1686942732; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2TweVo7pe1RT0U4fJi1MmEd78Di3WvMfNoLR23I7nbs=; b=TJnpjGBYjjHmbA0EUYQZUFNZg7RzvzKAPA1BNwYMzWPhyp6QTGLDQGi4UXBDnCYfj1 8AK03iaf7yQWqVIt2IqlPwCbORGSBrrFFiLjkuqy0uJIDT5EvGMnq7yOp8hC8Hao8qXL 8VrrGMfRANA9Tv4FcEeQA1aFdxt4U1xJxIPnA2VRc4beP23s7RhrlAyKmFZK7PGNTG+m KRjaNM4MJJf7GIkt4WNaABaSIsTpNmgtKSZcJAL+gCIQcBrvtlHeDPkMZp/PhSdfHF3R l9axOWr/Nop//u2T+7iIqfgO71vhGVP51Nq8UrjRntSNbk/FLa+mXhlxYPl7ERLoR+dr lMew== X-Gm-Message-State: AC+VfDyrShSE3+w7AI4J0/p6gPAA/l8xm3cx82+UwqFxnLsBcNWu/QFs i48gx4Y72AAicvxq/m4LYbl1gg== X-Received: by 2002:a17:902:9a46:b0:1ae:5f7e:c117 with SMTP id x6-20020a1709029a4600b001ae5f7ec117mr1313241plv.60.1684350732651; Wed, 17 May 2023 12:12:12 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id x21-20020a17090300d500b001a687c505e6sm18019526plc.232.2023.05.17.12.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 12:12:12 -0700 (PDT) Date: Wed, 17 May 2023 12:12:11 -0700 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Stanimir Varbanov , Vikash Garodia , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 2/2][next] media: venus: hfi_cmds: Use struct_size() helper Message-ID: <202305171212.11465CFF3@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 Tue, May 16, 2023 at 05:14:49PM -0600, Gustavo A. R. Silva wrote: > Prefer struct_size() over open-coded versions of idiom: > > sizeof(struct-with-flex-array) + sizeof(typeof-flex-array-elements) * count > > where count is the max number of items the flexible array is supposed to > contain. > > Link: https://github.com/KSPP/linux/issues/160 > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook -- Kees Cook