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 27D14AC137D for ; Mon, 16 Oct 2023 13:18:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=jHS6lHAPdYGkQtsUPuJOt+qxNtWq8wlwp5/ED66DJeI=; 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=1697462309; v=1; b=Vf5uGAwJbkRG9J8opRb7mMMnWNQie1BODW6vsTnlpH79Azq9IVQc5TcQjcmr7ebTjCyr18lO NHkcNr0SJ1/T/sdOAEECoYTJ/2kCUQzs6P783Brm8Ej8PvCAEzZnojVIqVkKBSjo3JGPZpE0P89 fsdoLdf4ctbWSgvST5GFQ59s= X-Received: by 127.0.0.2 with SMTP id vrmDYY7687511x4Nc0HyNVVy; Mon, 16 Oct 2023 06:18:29 -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.123816.1697462307983768733 for ; Mon, 16 Oct 2023 06:18:28 -0700 X-Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2c51388ccebso23845471fa.3 for ; Mon, 16 Oct 2023 06:18:27 -0700 (PDT) X-Gm-Message-State: vB3nWXwl1nndVubWHXdMp8MFx7686176AA= X-Google-Smtp-Source: AGHT+IEVlLJ662Dgs0XHlS0G1EXjIkUgO02TwqN+9DOtoabu6Uhu+9xFOy9easoYWWA5s4GXVBxp+Q== X-Received: by 2002:a2e:5109:0:b0:2c5:1a8e:e4c9 with SMTP id f9-20020a2e5109000000b002c51a8ee4c9mr3695169ljb.31.1697462305893; Mon, 16 Oct 2023 06:18:25 -0700 (PDT) X-Received: from PC10319.67 ([82.97.198.254]) by smtp.googlemail.com with ESMTPSA id 9-20020a2e1449000000b002ba586d27a2sm1362545lju.26.2023.10.16.06.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 06:18:25 -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 09/10] ManageabilityPkg: Use correct constants for PLDM header checks Date: Mon, 16 Oct 2023 16:18:15 +0300 Message-Id: <20231016131816.6634-10-aladyshev22@gmail.com> In-Reply-To: <20231016131816.6634-1-aladyshev22@gmail.com> References: <20231016131816.6634-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=Vf5uGAwJ; 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..3deded541a 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_IS_= 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, " Request bit =3D %d (Expected value: %d)\n",= PLDM_MESSAGE_HEADER_IS_RESPONSE));=0D + DEBUG ((DEBUG_ERROR, " Datagram =3D %d (Expected value: %d)\n",= PLDM_MESSAGE_HEADER_IS_DATAGRAM));=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 (#109642): https://edk2.groups.io/g/devel/message/109642 Mute This Topic: https://groups.io/mt/101994947/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-