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 6029278003C for ; Mon, 20 Nov 2023 12:13:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=BB4yALd8OC6I0Yr3LEmDCuL2wtNH4arm6DkxtF3UbBs=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1700482394; v=1; b=pOjKofR1iG/kv8pw3CYr8P1+knrvHtQip/utOgDtPDh0/dev5tS7jcQXDNYybR+EpLY5CzlS mtPTRbGrihj/JhZVHumO8EsrVhUIu/8JUjVDtKb0UgVTtX5e1wFTYgcBuisdLT24TTRVyOaaeTo L+2GhmVwmDYYQFFosqnkZ4u8= X-Received: by 127.0.0.2 with SMTP id ps4JYY7687511x7lrWpWhN7e; Mon, 20 Nov 2023 04:13:14 -0800 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.60]) by mx.groups.io with SMTP id smtpd.web10.48723.1700482393300699187 for ; Mon, 20 Nov 2023 04:13:13 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hvdcw1KQgRul6YWBpmIrr3J9pvWHFmeg3td5CCKFyG8q/gcMDC8AKLz4DFFKm7/neufWqRiDvD/kFr3UA4UU+Xj8u/psy7Q1kz46KgA/KrhC/v9R1+5xY6bTGxMipfjfAP9YPEq5jUX+CS3yCUz5NWGr1UhPBC/4WK9nVx/TWbSbm3dvufEYmN+CB3EVQJqIwjLPpZ71skcXEfWUqgR8GbFjwDaDpejksLVhWarpizsZU/VBqnC3icbnuXzldDOiVwUXB/0ensHYKAUQzkwC7VtdX8wjFGU22Ax0X/ViAcUcRlbLQoza3nVyoJ+6gPohOwsyrMwRK9nIOhdJuJFwnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q8nHWwxRNPSdRyAkdmrL5a5ijGEKp9Ic+zu9CyrmiGo=; b=buH7EhO5yxUSQPeP7PBCYAAGODVV/tQUXcYjVtl89QHg4JZA08/3d8kYwq4jdRujI147VHpoWoPGrX8nN4fTFrXMbNdgn5oj6c810TDxkFUZiyA83M2MrzoN5tg0s5xX/3vavFHCi/0CWJwqiTKgS1xACHG4A4fxN/IhlCmKBPq4HaJSH/cF0/IV6I3reW4QIwcoACsWNIeTWu8bXzHdnrZIjRN2roJClpXPy3FRK+kJYXsr7niNSNZ2qSUDPnIxEYWE6D8Hpvz3QAtAroLO2aLkeD7Jkt4mWMJu0wPGbLS8JCy4Ik3Gp487Jk7ukKZ2Ojb8w2reqmYyxkO0jz61+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by MW6PR12MB8898.namprd12.prod.outlook.com (2603:10b6:303:246::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.26; Mon, 20 Nov 2023 12:13:11 +0000 X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::91d9:e679:32a3:dd05]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::91d9:e679:32a3:dd05%4]) with mapi id 15.20.7002.027; Mon, 20 Nov 2023 12:13:10 +0000 From: "Chang, Abner via groups.io" To: Ashish Singhal , "devel@edk2.groups.io" , "quic_llindhol@quicinc.com" , "ardb+tianocore@kernel.org" , "git@danielschaefer.me" , "jbrasen@nvidia.com" Subject: Re: [edk2-devel] [PATCH v2 1/2] EmbeddedPkg: Fix Android Boot Command Line Length Bug Thread-Topic: [PATCH v2 1/2] EmbeddedPkg: Fix Android Boot Command Line Length Bug Thread-Index: AQHaF3GYlWbIQ8+McEGjG/g0U9xKYLCDJb1Q Date: Mon, 20 Nov 2023 12:13:10 +0000 Message-ID: References: <3ab879ada6d9f2b01496ecc05102510564888044.1700008662.git.ashishsingha@nvidia.com> In-Reply-To: <3ab879ada6d9f2b01496ecc05102510564888044.1700008662.git.ashishsingha@nvidia.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=74420a64-4491-43ab-8ad2-466d2ac8796a;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-11-20T12:08:47Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|MW6PR12MB8898:EE_ x-ms-office365-filtering-correlation-id: 3bf39332-017d-4251-edad-08dbe9c21030 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: D4bmwHQa1+7Tise6RpSuVzx+F/eQUUxNFvVhcs1IuUngt/4EpuGAkl40nwkHxgPLkiEOJHJklGYYmCrSbnaQJy/xrz5P6qkY262O/m3hcbm0ul6+IAYNM3DawClT46yH2J1fV5phel3nZ+0gnnQ8kbviWkaZldik6DoBICHihFEI2vsjBHu4V8jSf3usNZ8iv/wLL//AGoREAdY42FWgcdXGZFLFlkNa+LTWPwCTXOnXdLrWFXKqJ7qj26WLt5VMip7K6SWPHVBkIgNkfA3USlf9vtY0+AOsEe8TBG+nmRDRbYjGzc+Of0hRRISVzgYRowsa9436rNB5eA8s2A4YAL+CVjsjC4Uw3SMZZadjrBbcCUypu+kB3k8lr7KkJfWuwvXT6lgwKvaga/nwGz9PEU8bvKBfDIFmwUa6EE/DlaVyRQkOkGB+1Flyj2fqjQLScEYwZeVby6+Y9ZwNpRt/uUjbRnnxkO4NZq+3eVWK7edjXPvCCACJIXTTfC+Xvp9h3lheQWWDIbqmNUDg362BPi09A0IQFSbcvkfQV1ETgBeUrnRlll2rOVFwcofoORaUcSplGcN+S6K+v3fF7QiyPQP89EkiP0n5r6Fn4zeS1CzktqG/ZAwLYV8QHb5eAYbBV68hbg/J9eUcpxaOiqH5h2GTiwp99v3pqTHCmjvcq3Y= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?q5TCiY2iUcS2fFoiALA9JvTkEZds4E6UX6A0oMepguuLFnrYL3OLHjPf/M61?= =?us-ascii?Q?3rS475608PDRv5NXzH7ok1En24nnbMpC55b/hIcMEn7JeHHGcjqRIxY6+QlI?= =?us-ascii?Q?hrmgPzu6VLbU8R5ezlckcFlIhWiUmBJkSLxxUmwwxlyEWqJ0fs47Awvr1ae7?= =?us-ascii?Q?0WKOjZSX4fgVbV4fZQN0wlkFX8NtYrW2iX+QaH4zTwgQmsGYKbsH7uA8fywx?= =?us-ascii?Q?0FWR7zv7ML2ZfU8n6/HNUxoSxapGK8gSY/9Qh08DgKLTC0TTd4nskq5E9Wzu?= =?us-ascii?Q?vjUmg655mS8dx8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?us-ascii?Q?Du1bOiS7ogZ9I9c9F3MDGqcqU4UUOL2LyePLHjG9cRFVgI6xW3PfWbUmWawS?= =?us-ascii?Q?CjgJpNOvifbhawac9F+OeELkuG+DHafkxldOJWDfX1rJ8u1YAG3Q0LoP0bP4?= =?us-ascii?Q?2LuE2lPl0GGOgaTWI+1XOpwzTt4QAUwurVIUshmiLOVWTFpWYMAxOgAR6jpb?= =?us-ascii?Q?NbwuRlmrmkfHV6sn5eq452B56XiE0u204G5NdhrE/se0pB0b5xBE8Rta1YJd?= =?us-ascii?Q?GrPAKQ5OECjtPGi9NZ5sDWQ4yA7mIk6orh0TFuB0Sxg7wvzCctoikPZHHY/f?= =?us-ascii?Q?2oC/4U99aVVFdqE1VSOu7tF37J/ZvWwJYCgGd29iLUGEGECLcMp/FoZ4BEoX?= =?us-ascii?Q?wodIm4DqFZzywpLvGPw=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bf39332-017d-4251-edad-08dbe9c21030 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2023 12:13:10.7130 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: L0NRnPsrji407wS17ioow4Xpc5c/On47dlD1q7SwrazXAT8SZswdtjAlyliKAakW9Q/NA3DUxhFxWSN8fLdgNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8898 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,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: HQZQloT8ggRzt3lvhwRBABWVx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" 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=pOjKofR1; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=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 [AMD Official Use Only - General] Thanks for this update and two more comments, > -----Original Message----- > From: Ashish Singhal > Sent: Wednesday, November 15, 2023 11:12 AM > To: devel@edk2.groups.io; quic_llindhol@quicinc.com; > ardb+tianocore@kernel.org; Chang, Abner ; > git@danielschaefer.me; jbrasen@nvidia.com > Cc: Ashish Singhal > Subject: [PATCH v2 1/2] EmbeddedPkg: Fix Android Boot Command Line > Length Bug > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Curently, AndroidBootImgLib expects input kernel command line > to never exceed 256 unicode characters where the image header > allows for 512 ascii characters. If image header allows 512 > ascii characters, similar number of unicode characters should be > allowed at the minimum. > > Signed-off-by: Ashish Singhal > --- > .../AndroidBootImgLib/AndroidBootImgLib.c | 31 +++++++++++-------- > 1 file changed, 18 insertions(+), 13 deletions(-) > > diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c > b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c > index 1359a66db2..f63648e60d 100644 > --- a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c > +++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c > @@ -322,11 +322,12 @@ AndroidBootImgGetFdt ( > EFI_STATUS > AndroidBootImgUpdateArgs ( > IN VOID *BootImg, > - OUT VOID *KernelArgs > + OUT VOID **KernelArgs > ) I know the original code doesn't have the function header. Would you mind t= o add it as we change the prototype of this function? Or you probably would like to keep it as it for the consistence, as no func= tion header for any of functions in this file. > { > CHAR8 ImageKernelArgs[ANDROID_BOOTIMG_KERNEL_ARGS_SIZE]; > EFI_STATUS Status; > + UINT32 NewKernelArgSize; > > // Get kernel arguments from Android boot image > Status =3D AndroidBootImgGetKernelArgs (BootImg, ImageKernelArgs); > @@ -334,16 +335,23 @@ AndroidBootImgUpdateArgs ( > return Status; > } > Do you think we have to check if the ASCII string size in ImageKernelArgs g= reater than ANDROID_BOOTIMG_KERNEL_ARGS_SIZE? Thanks Abner > + NewKernelArgSize =3D ANDROID_BOOTIMG_KERNEL_ARGS_SIZE; > + *KernelArgs =3D AllocateZeroPool (sizeof (CHAR16) * NewKernelArgS= ize); > + if (*KernelArgs =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "Fail to allocate memory\n")); > + return EFI_OUT_OF_RESOURCES; > + } > + > AsciiStrToUnicodeStrS ( > ImageKernelArgs, > - KernelArgs, > - ANDROID_BOOTIMG_KERNEL_ARGS_SIZE >> 1 > + *KernelArgs, > + NewKernelArgSize > ); > // Append platform kernel arguments > if (mAndroidBootImg->AppendArgs) { > Status =3D mAndroidBootImg->AppendArgs ( > - KernelArgs, > - ANDROID_BOOTIMG_KERNEL_ARGS_SIZE > + *KernelArgs, > + NewKernelArgSize > ); > } > > @@ -616,6 +624,10 @@ AndroidBootImgBoot ( > UINTN RamdiskSize; > IN VOID *FdtBase; > > + if ((Buffer =3D=3D NULL) || (BufferSize =3D=3D 0)) { > + return EFI_INVALID_PARAMETER; > + } > + > NewKernelArg =3D NULL; > ImageHandle =3D NULL; > > @@ -637,14 +649,7 @@ AndroidBootImgBoot ( > goto Exit; > } > > - NewKernelArg =3D AllocateZeroPool > (ANDROID_BOOTIMG_KERNEL_ARGS_SIZE); > - if (NewKernelArg =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "Fail to allocate memory\n")); > - Status =3D EFI_OUT_OF_RESOURCES; > - goto Exit; > - } > - > - Status =3D AndroidBootImgUpdateArgs (Buffer, NewKernelArg); > + Status =3D AndroidBootImgUpdateArgs (Buffer, &NewKernelArg); > if (EFI_ERROR (Status)) { > goto Exit; > } > -- > 2.17.1 -=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 (#111467): https://edk2.groups.io/g/devel/message/111467 Mute This Topic: https://groups.io/mt/102598724/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-