Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2789625rwd; Fri, 26 May 2023 11:12:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62AWRHKOXEmn4kwRcd9OET9yzs0Um++3RdVabOyULBa1bGB4afnKfwBbG+wE6d8FiY5enA X-Received: by 2002:a17:90a:69c3:b0:256:3191:640f with SMTP id s61-20020a17090a69c300b002563191640fmr2959032pjj.4.1685124738676; Fri, 26 May 2023 11:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685124738; cv=none; d=google.com; s=arc-20160816; b=ZUm4VRZSaWKKc/GctIfqeR86jE0LZ/nYUDmMZn0ZmaSS9V5FzXdaBlii7h8KPGwsmz v396YxB3muc8Ra/ywSyMa1K1dt19XgHetlQhJ0ykhkJaOz5SFFsyCCWVmhQC6LDDPjn9 sNUGEtVlCwu9MMHj3gdc1I39HKtciLpNDq+nYLZiXz3UK3idi0xJKqikAlLSKutj1ftj sZwvDpsEfcFyERf62mu6trp1G+IVh8a7HTe5iZiHGqi81VnjFvvomCVm4Cby1G4bzwqj NLnsldzAjaWVGX53tFmA9TGVQBmUGyDoEdqHX7p9qGeSICSNAW3+JWBdKMksP0JOIp4S RXcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fht1zDJnuyN2MCML343tn7swHMMeG8E3Gb5CsmDfP6E=; b=K0it9iPx31tgbJ6M7BEACVNVU0ZhOTtKMzwIrHfs+qe8dBtWh6vD4PkKxFpa8Tjn3H Z3IpufJ+Zb7ZycA6HPbr49qWafU7dO8F0T2TqrK6v3X17Mu145odp0rTLndyJbTJCjG3 dq96rR2iXXulqdjyUrkSHeUA/lu0x72sVWZQJcd2KND5jiPr4SV28nK3x6zbHfCJwPcp W/kMFovFfQ4MihSNUQ++k8ZtV1hfjE7n8UE3hxZfSAe3MzPj8OP8kbGkvPgnxnSiuHL1 qXxY+H1/csutCqLR9QSS6dfFpHcuoNFs3Iw3zb5ub/dZpU+Ps013gRTEeYcnGIhU1x5w UrFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=AJ5cCQ+F; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u74-20020a63794d000000b0053ef4189de6si4248363pgc.372.2023.05.26.11.12.04; Fri, 26 May 2023 11:12:18 -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=@broadcom.com header.s=google header.b=AJ5cCQ+F; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229519AbjEZSHM (ORCPT + 99 others); Fri, 26 May 2023 14:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbjEZSHL (ORCPT ); Fri, 26 May 2023 14:07:11 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FAA9125 for ; Fri, 26 May 2023 11:07:09 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-30adc69c0dbso493377f8f.1 for ; Fri, 26 May 2023 11:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1685124427; x=1687716427; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fht1zDJnuyN2MCML343tn7swHMMeG8E3Gb5CsmDfP6E=; b=AJ5cCQ+Fvp/uVzFJcHHWPeSR/unaz3Oi99T+GlvjFGxcDcoPAc2vyIFWgQ2HaIWQXj GpkiKeGYh06y3XF1cqAHWNUlHCFsHHU8qbkO2ojOOoJU3NOg5VLctKj1i2BaWvtyUapL XR2Oq+QIkzoxoKzltqj0Pe35WMMwhmGOFfxm8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685124427; x=1687716427; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fht1zDJnuyN2MCML343tn7swHMMeG8E3Gb5CsmDfP6E=; b=Hzf9JkWNYM1vQ644eahH/16iRl2GoAR23dxa8QmeCaLFTfHFpPpczAoRA3NPJbxRYp 21k+QFdaM43aLSmSQX1ojt7m4gFtZ96aUrIybUeMc0883hKUeIOCvpkBQ+Eu6/eIY4o1 tO+gl9OORi5rEuV8WK/dTBhdDzRNZTB5kGwI+yjzlzaB1I3FVlN+M2uBVL2eABsMlVrl SEBG7odd47eUQRFnRcz5kq9Ji4GSZ+n19QoCrID4D1DNgkzP6ZV9aRkiUmq2r+AJp3+h 7CIulFofyp0PwwL5rpnMCSuS9IoASdXsGfaqopTELDZ+gsdmIDVoRoqeXLkoJF6oiilu juYw== X-Gm-Message-State: AC+VfDytcIuDGKnQg2pAD78MwofN4k052J1QiAPY0WsLPVkRY0lEqpG7 aUEa+0pT/a4aRQM8mDiOs8R0n09yPVN4eeFuQLss8N8MOj3E0j3qX1RCLcthZjF/IV2Ssq4+7B4 i/ExMwZ4RLCM5XYGrC4T9FtcKRx/srGw= X-Received: by 2002:a5d:54c4:0:b0:30a:8c0b:320e with SMTP id x4-20020a5d54c4000000b0030a8c0b320emr1937561wrv.10.1685124427401; Fri, 26 May 2023 11:07:07 -0700 (PDT) MIME-Version: 1.0 References: <202305261041.4C23B96F@keescook> In-Reply-To: <202305261041.4C23B96F@keescook> From: Justin Tee Date: Fri, 26 May 2023 11:06:55 -0700 Message-ID: Subject: Re: [PATCH v2][next] scsi: lpfc: Use struct_size() helper To: Kees Cook Cc: Justin Tee , "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 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000ebc97805fc9c9afb" 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_NONE,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 --000000000000ebc97805fc9c9afb Content-Type: text/plain; charset="UTF-8" > > We probably should have declared no_of_objects as __be32 to have > > avoided this confusion. > > Perhaps this patch can add that too? Yes, please. Something like this is fine: diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index 19b2d2754f32..e5a639d96122 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h @@ -1414,12 +1414,12 @@ struct app_id_object { }; struct lpfc_vmid_rapp_ident_list { - uint32_t no_of_objects; + __be32 no_of_objects; struct entity_id_object obj[1]; }; struct lpfc_vmid_dapp_ident_list { - uint32_t no_of_objects; + __be32 no_of_objects; struct entity_id_object obj[1]; }; -- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it. --000000000000ebc97805fc9c9afb Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQZwYJKoZIhvcNAQcCoIIQWDCCEFQCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg2+MIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTEwLwYDVQQDEyhHbG9iYWxTaWduIEdDQyBS MyBQZXJzb25hbFNpZ24gMiBDQSAyMDIwMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA vbCmXCcsbZ/a0fRIQMBxp4gJnnyeneFYpEtNydrZZ+GeKSMdHiDgXD1UnRSIudKo+moQ6YlCOu4t rVWO/EiXfYnK7zeop26ry1RpKtogB7/O115zultAz64ydQYLe+a1e/czkALg3sgTcOOcFZTXk38e aqsXsipoX1vsNurqPtnC27TWsA7pk4uKXscFjkeUE8JZu9BDKaswZygxBOPBQBwrA5+20Wxlk6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