From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id E9A867803D7 for ; Fri, 20 Oct 2023 12:53:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=X2Fpw6sPOo0LWYcwQW8hqwfKxnGegOfWf6CS8bMnqeo=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1697806400; v=1; b=uZ3lk8RrjMz8wtB+c9+/N3Vd8mOVJzQ6ENscIBypewIXBukVfLxTW3IKatpQtr9nmrB/dYyU VuKmDiZI5qve8cFkAKla+/3zF4Lbcdc9INFFRVcNcvG5at+5NmtjzvynULqZaWdUuyUlt6c/3y9 KtHHA7zuJkLbZBEUdnLfJWbQ= X-Received: by 127.0.0.2 with SMTP id 70AmYY7687511xFS70rqjmkJ; Fri, 20 Oct 2023 05:53:20 -0700 X-Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mx.groups.io with SMTP id smtpd.web10.53387.1697806399854594534 for ; Fri, 20 Oct 2023 05:53:20 -0700 X-Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2c501bd6ff1so11037011fa.3 for ; Fri, 20 Oct 2023 05:53:19 -0700 (PDT) X-Gm-Message-State: qeZmSPpq8a39Oi93ELCyAcjGx7686176AA= X-Google-Smtp-Source: AGHT+IFeuOQzBiw68p7OuC2l4dkauxbW3EEXAvW21hnP0SD6L/5IrIj9ONGQeSNM69YFDI3INxayTg== X-Received: by 2002:a05:651c:504:b0:2c5:72e:6ff7 with SMTP id o4-20020a05651c050400b002c5072e6ff7mr1384741ljp.24.1697806397743; Fri, 20 Oct 2023 05:53:17 -0700 (PDT) X-Received: from PC10319.67 ([82.97.198.254]) by smtp.googlemail.com with ESMTPSA id x22-20020a05651c105600b002b9e5fe86dasm350853ljm.81.2023.10.20.05.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:16 -0700 (PDT) From: "Konstantin Aladyshev" To: devel@edk2.groups.io Cc: abner.chang@amd.com, isaac.w.oram@intel.com, AbdulLateef.Attar@amd.com, nicklew@nvidia.com, Konstantin Aladyshev Subject: [edk2-devel] [PATCH edk2-platforms v2 09/15] ManageabilityPkg: Use correct constants for PLDM header checks Date: Fri, 20 Oct 2023 15:52:56 +0300 Message-Id: <20231020125302.1459-10-aladyshev22@gmail.com> In-Reply-To: <20231020125302.1459-1-aladyshev22@gmail.com> References: <20231020125302.1459-1-aladyshev22@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,aladyshev22@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=uZ3lk8Rr; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Currently PldmProtocol code uses magic numbers in the PLDM header checks. Since PLDM headers have all the necessary definitions replace magic numbers with the appropriate defines. Signed-off-by: Konstantin Aladyshev --- .../Universal/PldmProtocol/Common/PldmProtocolCommon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.c index 1c4506d87f..4edfe05955 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c @@ -321,15 +321,15 @@ CommonPldmSubmitCommand ( //=0D // Check the integrity of response. data.=0D ResponseHeader =3D (PLDM_RESPONSE_HEADER *)FullPacketResponseData;=0D - if ((ResponseHeader->PldmHeader.DatagramBit !=3D 0) ||=0D - (ResponseHeader->PldmHeader.RequestBit !=3D 0) ||=0D + if ((ResponseHeader->PldmHeader.DatagramBit !=3D (!PLDM_MESSAGE_HEADER_I= S_DATAGRAM)) ||=0D + (ResponseHeader->PldmHeader.RequestBit !=3D PLDM_MESSAGE_HEADER_IS_R= ESPONSE) ||=0D (ResponseHeader->PldmHeader.InstanceId !=3D mPldmRequestInstanceId) = ||=0D (ResponseHeader->PldmHeader.PldmType !=3D PldmType) ||=0D (ResponseHeader->PldmHeader.PldmTypeCommandCode !=3D PldmCommand))=0D {=0D DEBUG ((DEBUG_ERROR, "PLDM integrity check of response data is failed.= \n"));=0D - DEBUG ((DEBUG_ERROR, " Request bit =3D %d (Expected value: 0)\n"))= ;=0D - DEBUG ((DEBUG_ERROR, " Datagram =3D %d (Expected value: 0)\n"))= ;=0D + DEBUG ((DEBUG_ERROR, " Datagram =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.DatagramBit, (!PLDM_MESSAGE_HEADER_IS_DATAGRAM)= ));=0D + DEBUG ((DEBUG_ERROR, " Request bit =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.RequestBit, PLDM_MESSAGE_HEADER_IS_RESPONSE));= =0D DEBUG ((DEBUG_ERROR, " Instance ID =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.InstanceId, mPldmRequestInstanceId));=0D DEBUG ((DEBUG_ERROR, " Pldm Type =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.PldmType, PldmType));=0D DEBUG ((DEBUG_ERROR, " Pldm Command =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.PldmTypeCommandCode, PldmCommand));=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109859): https://edk2.groups.io/g/devel/message/109859 Mute This Topic: https://groups.io/mt/102080238/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-