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 2B212AC11AE for ; Mon, 23 Oct 2023 13:05:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=zY7KFNuWGxieHJgB8H+PZi9WzfsPjwy+TQPYUQfzkBk=; 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=1698066326; v=1; b=wSg4Hlg5vDeeyycK/WIW+k9bqVJFCJKJimqH3DcbsFdKYCwpLAYeHec3OLeBYZ/od8w6anAH Uu7pJxhNYXjYWGKeA3B2cZSLWwGZZe2YAmqv2CWz9a9V+/7gTTZ4LtlHnmueASuY6xyexFOyHYh FnbI9AYJuIK+EMeTqyHYkcjk= X-Received: by 127.0.0.2 with SMTP id cUjHYY7687511x1XY8JAjakn; Mon, 23 Oct 2023 06:05:26 -0700 X-Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by mx.groups.io with SMTP id smtpd.web11.120288.1698066324651358385 for ; Mon, 23 Oct 2023 06:05:25 -0700 X-Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2bfed7c4e6dso48588971fa.1 for ; Mon, 23 Oct 2023 06:05:24 -0700 (PDT) X-Gm-Message-State: Eu7mRGbDFyYktYwq5c0QOgqWx7686176AA= X-Google-Smtp-Source: AGHT+IHOVsIRYeKaSek0uvhFIDDzkTdQNI4UgdMegUeQoTsgCNuGyfDmMgeHmCiD51BD1kFMc0XZYA== X-Received: by 2002:a2e:b911:0:b0:2c5:2132:24f5 with SMTP id b17-20020a2eb911000000b002c5213224f5mr5769107ljb.53.1698066322561; Mon, 23 Oct 2023 06:05:22 -0700 (PDT) X-Received: from PC10319.67 ([82.97.198.254]) by smtp.googlemail.com with ESMTPSA id r11-20020a2e994b000000b002b9e0d19644sm1550081ljj.106.2023.10.23.06.05.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 06:05:22 -0700 (PDT) From: "Konstantin Aladyshev" To: devel@edk2.groups.io Cc: abner.chang@amd.com, AbdulLateef.Attar@amd.com, nicklew@nvidia.com, Konstantin Aladyshev Subject: [edk2-devel] [PATCH edk2-platforms v3 09/16] ManageabilityPkg: Use correct constants for PLDM header checks Date: Mon, 23 Oct 2023 16:05:04 +0300 Message-Id: <20231023130511.4521-10-aladyshev22@gmail.com> In-Reply-To: <20231023130511.4521-1-aladyshev22@gmail.com> References: <20231023130511.4521-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=wSg4Hlg5; 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 (#109917): https://edk2.groups.io/g/devel/message/109917 Mute This Topic: https://groups.io/mt/102134657/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-