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 76669941DB8 for ; Sun, 26 Nov 2023 19:31:02 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Q/wMc3Q5eF8ac+xJwZiVhsD6oAAqYT8IohTg2uadMcY=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1701027061; v=1; b=NC07R3SD6R5nqpnuB7SmlDBVHwlf82AhwnyE9qo513sgLnuGYWh1iaScu/iKZvT7DvYkAc0X y8c0W2lCAP97LRKwPAjfdPggT8dEUTq9OW22dqOOmsgH3ViisyljSLOxCfmdyA5u9SEGX2FiBga 6nAIu9GffrY21QicUt+PnTtc= X-Received: by 127.0.0.2 with SMTP id Y78AYY7687511xkXra33XQk7; Sun, 26 Nov 2023 11:31:01 -0800 X-Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) by mx.groups.io with SMTP id smtpd.web10.64284.1701027060259884744 for ; Sun, 26 Nov 2023 11:31:00 -0800 X-Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-5cfa3a1fb58so6521157b3.2 for ; Sun, 26 Nov 2023 11:31:00 -0800 (PST) X-Gm-Message-State: 70wp0cwcXCLwqr4davzTjSZ8x7686176AA= X-Google-Smtp-Source: AGHT+IFCYKTLYZARRHu2fISed94J/gD3E05DALsDokGDBsx9Icu+2BiHv8WHpr2EZNLQKZMPPqDEHF0ZWVTpnn6hTVs= X-Received: by 2002:a0d:d747:0:b0:5be:ae23:c002 with SMTP id z68-20020a0dd747000000b005beae23c002mr9979200ywd.26.1701027059422; Sun, 26 Nov 2023 11:30:59 -0800 (PST) MIME-Version: 1.0 References: <20231123064719.1248-1-abner.chang@amd.com> <20231123064719.1248-9-abner.chang@amd.com> In-Reply-To: <20231123064719.1248-9-abner.chang@amd.com> From: "Mike Maslenkin" Date: Sun, 26 Nov 2023 22:30:23 +0300 Message-ID: Subject: Re: [edk2-devel] [PATCH V2 8/8] RedfishPkg/HostInterfaceBmcUsbNic: Fix incorrect HI protocol record size To: abner.chang@amd.com Cc: devel@edk2.groups.io, Nickle Wang , Igor Kulchytskyy 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,mike.maslenkin@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" 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=NC07R3SD; 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 On Thu, Nov 23, 2023 at 9:48=E2=80=AFAM wrote: > > From: Abner Chang > > The size of structure must be minus with byte that is > occupied by the initial array. > > Signed-off-by: Abner Chang > Cc: Nickle Wang > Cc: Igor Kulchytskyy > Cc: Mike Maslenkin > --- > .../PlatformHostInterfaceBmcUsbNicLib.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/Platfor= mHostInterfaceBmcUsbNicLib.c b/RedfishPkg/Library/PlatformHostInterfaceBmcU= sbNicLib/PlatformHostInterfaceBmcUsbNicLib.c > index c4a71226e63..a1ce2dd3d93 100644 > --- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostIn= terfaceBmcUsbNicLib.c > +++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostIn= terfaceBmcUsbNicLib.c > @@ -180,7 +180,7 @@ RedfishPlatformHostInterfaceProtocolData ( > HostNameLength =3D (UINT8)AsciiStrSize (HostNameString); > ThisProtocolRecord =3D (MC_HOST_INTERFACE_PROTOCOL_RECORD *)Alloca= teZeroPool ( > sizeof= (MC_HOST_INTERFACE_PROTOCOL_RECORD) - 1 + > - sizeof= (REDFISH_OVER_IP_PROTOCOL_DATA) + > + sizeof= (REDFISH_OVER_IP_PROTOCOL_DATA) - 1 + > HostNa= meLength > ); > if (ThisProtocolRecord =3D=3D NULL) { > @@ -189,7 +189,7 @@ RedfishPlatformHostInterfaceProtocolData ( > } > > ThisProtocolRecord->ProtocolType =3D MCHostInterfaceProtoco= lTypeRedfishOverIP; > - ThisProtocolRecord->ProtocolTypeDataLen =3D sizeof (REDFISH_OVER_I= P_PROTOCOL_DATA) + HostNameLength; > + ThisProtocolRecord->ProtocolTypeDataLen =3D sizeof (REDFISH_OVER_I= P_PROTOCOL_DATA) -1 + HostNameLength; > RedfishOverIpData =3D (REDFISH_OVER_IP_PROTO= COL_DATA *)&ThisProtocolRecord->ProtocolTypeData[0]; > // > // Fill up REDFISH_OVER_IP_PROTOCOL_DATA > -- > 2.37.1.windows.1 > Excellent! BTW could we use zero-sized array for REDFISH_OVER_IP_PROTOCOL_DATA::RedfishServiceHostname? Alternatively, we could use "HostNameLength =3D (UINT8) AsciiStrLen (HostNameString);" with appropriate comment, that space for \0 is already reserved, -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111704): https://edk2.groups.io/g/devel/message/111704 Mute This Topic: https://groups.io/mt/102763123/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-