Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2803591rwd; Fri, 26 May 2023 11:26:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/C7FrA0R0W/LjZ4yQULSaoFrIUO2o/OYKE1pPi/nf8PnvKQV3huH9SoPHGSvQ4vV87Jrp X-Received: by 2002:a17:90a:d3c8:b0:255:75e5:b456 with SMTP id d8-20020a17090ad3c800b0025575e5b456mr3280700pjw.1.1685125582700; Fri, 26 May 2023 11:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685125582; cv=none; d=google.com; s=arc-20160816; b=SQiy4N+9fx7RGWHIwr/d5NxY21pqYYHPvqy7YC0zJlKqdoHFm1zn4rAfhS2AqbM+WH g52CJa6BQqIsZKDmGweTHTradWjESQsDMHGWlZICjn+3HtE3T9MgljT61vbOs1D7eDDj ImBpJtoSOPYuX5xIGsBFoTlaQZENo5OI3jTssq7BC8xxLYJom9QLq1yX7MSrnfHiTKrB XLsROKxcS96eQwg9MOkPi2sBgonBiW6nR3XJzhTTgGYuu5uQZTIIyRyUhQxI1ePXotq2 bSQ1mNV21HrPdUhnb+RVDPiHxhDFENvxcLs2i/qodKxI1kGRE8hTbGtg9HreVvHCx0+C AWrQ== 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=mzkLCtK6sSR84gGu0pHUyFqZuhAc6wVW3zGt3fCHd8A=; b=cfVCRLQfaj6yMpAsSlJesVt+y8NvYidM+I8CH4OYVt6keg25H2/CbbOb2riEIO/sI0 4PvbdfgeKCLw9S4BmF68+yD21o7EgVI5Rb8qeZgRCce23RQSMVOUE3/I1UcyzW5+8ivM 05evUwkW1/H3NUvV3gi8y6hVUp5Xv9BlYuoZbukMY5PvC1NgC2KxGR82R+OhK65weoW/ ARNVGHE8ujJC3VAtYo41iZTle+1wfZz8LPcpABCpiOLLON6Gl5Pwep0cLYz1sYxZFQx7 fWQcePliH27Wsp+gu2p7uNc0QsT8yu1pPuJhC+ps2GcpiORQZCRdQG/UrL3Qp6M3WJxZ 9aJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QT6t4K12; 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 ng10-20020a17090b1a8a00b0024e1138cd9dsi5237314pjb.157.2023.05.26.11.26.07; Fri, 26 May 2023 11:26:22 -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=QT6t4K12; 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 S242729AbjEZRmY (ORCPT + 99 others); Fri, 26 May 2023 13:42:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237022AbjEZRmW (ORCPT ); Fri, 26 May 2023 13:42:22 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20817F7 for ; Fri, 26 May 2023 10:42:01 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-64d30ab1f89so892972b3a.3 for ; Fri, 26 May 2023 10:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685122920; x=1687714920; 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=mzkLCtK6sSR84gGu0pHUyFqZuhAc6wVW3zGt3fCHd8A=; b=QT6t4K12P7rnXTLcm5Lx1LIZR1MPJa9FlTsCngYetkrHw3sW46rIqrAG1AFjR8sWb6 kIvHb3q2cPGCw6h3OkWVbOiBxVeSEpSTqOqfM+xcIz7QH+jBL8MQ9P0vdtnqEraXN+Yt QJqA79OMHWrFkJtTGNVC03Dm7r4+gPEB2HJnY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685122920; x=1687714920; 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=mzkLCtK6sSR84gGu0pHUyFqZuhAc6wVW3zGt3fCHd8A=; b=GiBoYt5fAJEnsJZSW5kMhx8ZJYxzteWqihy55NY97hRbnJ+KNL+B5yv77pZ25W0/wp 8YjQxSk1Q+FOD1dHGFc6iOruvfNxOQ8zgaenyhJJMTObh8DLY9w9j+XQ7ISlMgqyZKrO OV8n/Nc8hHJLLV73O0Ku4y20aNeJhW++7cVL3VGn4LAtNmQQwdcpVSTUdgsdvPRZgfD/ kw7q2PR/NOZ8FNlAxiU1qbg/Rhf7yYoZNcbi6f0AJaT9GJ0PRpu0OAhqDniMfR9fm6fR F06WuNe/smAtA4zw3h4ognP1bWy3jw68qxM/p416qkKc5zB+4Z+EaSXCNxn8QnfmOorJ 3tqQ== X-Gm-Message-State: AC+VfDzXwrLN02nJ/U80bVB/8NYkARrVLv4A7l0kijsm1l4Lz2rCckwW Zd2VDWCCAvH053mrbPhPdBXvKg== X-Received: by 2002:a05:6a00:98e:b0:64a:c673:d064 with SMTP id u14-20020a056a00098e00b0064ac673d064mr4744620pfg.17.1685122920652; Fri, 26 May 2023 10:42:00 -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 n17-20020aa78a51000000b0064389eab4c8sm2947098pfa.126.2023.05.26.10.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 10:42:00 -0700 (PDT) Date: Fri, 26 May 2023 10:41:59 -0700 From: Kees Cook To: Justin Tee Cc: "Gustavo A. R. Silva" , James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Justin Tee Subject: Re: [PATCH v2][next] scsi: lpfc: Use struct_size() helper Message-ID: <202305261041.4C23B96F@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=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 Tue, May 23, 2023 at 10:25:20PM -0700, Justin Tee wrote: > no_of_objects may be hardcoded to 1 right now, but does it make more > sense to use? > > struct_size(rap, obj, be32_to_cpu(rap->no_of_objects)); Oh yeah, that's nicer. :) > We probably should have declared no_of_objects as __be32 to have > avoided this confusion. Perhaps this patch can add that too? -- Kees Cook