From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web08.4551.1610606089722476941 for ; Wed, 13 Jan 2021 22:34:49 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=EMHLzII0; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: zhichao.gao@intel.com) IronPort-SDR: gz2xsiXuIqvkoOL4AaOPux/OJ2EuSYLsHZUZ3JfGuXREk7hYiqmpnZjaiGAcjFH6byD8vlHRwS Fd5FZKFg/Zvw== X-IronPort-AV: E=McAfee;i="6000,8403,9863"; a="239857554" X-IronPort-AV: E=Sophos;i="5.79,346,1602572400"; d="scan'208";a="239857554" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2021 22:34:48 -0800 IronPort-SDR: OGnICJJ+fCSBYrzcTXx3UbFOnNbnPVsR+0V1P2QKOFRS879HRLbRpRuGOSiRXBaPQu5SXsgl28 xjY4UslVo/Kw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,346,1602572400"; d="scan'208";a="389715010" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga007.jf.intel.com with ESMTP; 13 Jan 2021 22:34:48 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 13 Jan 2021 22:34:48 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 13 Jan 2021 22:34:47 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 13 Jan 2021 22:34:47 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.105) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 13 Jan 2021 22:34:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hHBQfzxrAcXo9oVTN7B6nE2LxifW9W552R1YeqV7E4Vj5P6bglyau74kp6Zj+yfkaidOhRBXtdTS96eRwMbFFDjqqNzE5BAi/+y3NqHCaQuFrTc+f+GzPWhru4G3HpyQKRcL67ZYQ1chgWJRKXQxQdArYC4mVoRbRCguKCyTyGeD6xYjUZhId9rBoeeyubpnF5WneQ3EWM3BjGgubU+yfOqMK+wFecl5Wg7Jv/ZKtBIs5hv2MqM7UFqhBdVKuYMmnUqdAL7v9J21tr6/G0VP8ebPCA2PyDsuH6ejCGUr7QiHwQzCKwhhNmBe32vtR3FdWqsU2Mlf+p2PXj/IE5m9HQ== 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-SenderADCheck; bh=2sd1UnGqC7ZsW34h4d4EMIzZZvvSSaTxNYHTxvz5hE4=; b=Wr4Iua5lxZtYO2AhNJFOyYQfG32YZrBUDYuY9l5utGZ1orwawPrFCwD5pxyveRc7Ke6cz4iRuKaVwBT3EuKqL7jI0h3px14AXvbpIS9JMy6veGVq9mlJhJracQSV5NPoRrrKvMBhJdGz46JjZBLtnWIIb28DYIRL0IdkvmH2xf79kysKWiEpHhjCZh8pEbYlmxJO5SaLrWyiGVpH6uG/UkvSOjwKMlmhX7krGuMNDIeRSJkyFcjp3REuDDpmZWJGx3aIGRjGTYXgDuhowM9MgVuWepiJpF1A+jw4QxzCOxykVUzEPj7gHKPbjZAbyuJS4v+Znbcsjgx2j/ELbtC79g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2sd1UnGqC7ZsW34h4d4EMIzZZvvSSaTxNYHTxvz5hE4=; b=EMHLzII0mXI0wvphfYlcyxrhA+AGcIv+oKl1OT6etKJwpTwjLqPMBVBTxzKnOQaXgYwZN9UkBhEN3hI1zE8WPjimG63A8ehM/+iuo6/iFBw+3psNgpOJ6/2JTIqm36HyxDMKUOJ4gyI4Ig+eqoEQcirpZaUw/9lOeEUqmjkUZAs= Received: from MWHPR11MB1647.namprd11.prod.outlook.com (2603:10b6:301:d::12) by MWHPR1101MB2254.namprd11.prod.outlook.com (2603:10b6:301:58::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Thu, 14 Jan 2021 06:34:46 +0000 Received: from MWHPR11MB1647.namprd11.prod.outlook.com ([fe80::c861:b9c1:b082:7c77]) by MWHPR11MB1647.namprd11.prod.outlook.com ([fe80::c861:b9c1:b082:7c77%8]) with mapi id 15.20.3742.012; Thu, 14 Jan 2021 06:34:46 +0000 From: "Gao, Zhichao" To: "gechao@greatwall.com.cn" CC: "devel@edk2.groups.io" , "Ni, Ray" Subject: Re: [PATCH] MdeModulePkg/TerminalDxe [BUG]: Terminal fifo buffer overflow. Thread-Topic: [PATCH] MdeModulePkg/TerminalDxe [BUG]: Terminal fifo buffer overflow. Thread-Index: AQHW6iSitki2de4wAkWCJ8AqJv/MTaomqRNw Date: Thu, 14 Jan 2021 06:34:46 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: greatwall.com.cn; dkim=none (message not signed) header.d=none;greatwall.com.cn; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.213] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a7a2fd33-c6ea-4aab-08e2-08d8b8567c3e x-ms-traffictypediagnostic: MWHPR1101MB2254: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: djOv8YDg6nIXxMD7TRNNc7ZPFVek9lLEicbzeuYVSvMZp9eG2em2GU4HMj5lDNHLRzG6yIYXsgOmxIPHyQDqnCCtLvtdbNardv0cHyw9utVnuN/IeP0n4WvFNuZI5syyD7FYNvqjqzRJDiSAkLIZJ0lKREoT83geONmNf7EfNsFztho7LAumTUl4RsAn7SLeeN3DZDXSoKWd6TGvZAczXFdZJqnTf2azxFox192AhC3LvMPtvd6CnbJYTFZU/hPl0kBcRh8Wjzz81owvhliRlr3f1+Q/sEoN9ykBDd8cYT1o6whlHbl+dXQjzcJR0Pvj1Bx1b/tur6UglbyR57qzMMqtqyGIEWDXb6uq1jlqQMGcLHmTWSUBfUAukoVgBcYhroOnm0+dIbxSzjSmGP8txA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1647.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(39860400002)(396003)(346002)(366004)(376002)(9686003)(76116006)(4326008)(52536014)(55016002)(53546011)(5660300002)(6506007)(2906002)(71200400001)(8936002)(83380400001)(6916009)(86362001)(7696005)(26005)(66556008)(64756008)(66446008)(33656002)(66476007)(107886003)(54906003)(66946007)(8676002)(316002)(478600001)(186003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?rwx2mGYI3A1oKLvRcIHBhjrSRtpaX1s4AuabNeMA+2wNTH/ZsgjotrcZn4ZH?= =?us-ascii?Q?tJktwwoWYVl8+TcbDDT0amf8yhiAG5nWQaaMcOvdaC5ntVbJr/bMPFJm0crE?= =?us-ascii?Q?sTT+F8m+xxqwOIKwznXMxwADNegBIp7WUtmjQHZyJj30m+tlyAlM5hxiTgnt?= =?us-ascii?Q?3RdNZ0v1Ih9aU8L2QlQeAW//B5NLee+dtlWL0RwroUbQYpYCgA0eRqQgHR72?= =?us-ascii?Q?trhmwAPB1zK0fZlPMV7AsjcVtYyahPh33qr4EOuF7dcbNonqNPVtolAjGJ9K?= =?us-ascii?Q?Qk6hK7TuFvNKJb6Yn5dIBCIGL02w45avr/+qMomcsAmwQ3dFGE95vbfezV8u?= =?us-ascii?Q?4thfNx43HcoBg564JzzdRp9FCQDX485sED0uozNCxwnTI1BLdRjQAAaXM/fl?= =?us-ascii?Q?/uiZbU0c7QJDQL8YC1Eu9XTVZLWhTE3Ra22VngZHFwwRDQwYnX8OSAuy21/J?= =?us-ascii?Q?HqpXtY7jJMnMuhkPEBlS3OHKo+MYZqFE+zUgLuYpr/OVaPuJwNQVksguisYM?= =?us-ascii?Q?n6RM83f20xZNDJaM7fcZ1F6o4a6q9cw7r/E8v5NZKb4GyhzcVMK9vyS8uXJg?= =?us-ascii?Q?N9geHy9q1iS/VFv5IZfRhkGeixqm+p0fIaY9AMl6GmC9eHtTwiiuPR+SYs0s?= =?us-ascii?Q?IPvn5aqi6QgXnmrOtt+gDfwaxeHGno+D5SR51pCuHGPgDtqQFcRkTbxwiehM?= =?us-ascii?Q?MKBtplMazoNcRMxHVqEjGBJaR7ld3ajwCmMVB5hjvFAcIi0nZ6j6RwOhAq1+?= =?us-ascii?Q?P85UT6xGq7T6G4EXWzn9nVARgZ9ACiD6ed09Z2RG05Pu8wxPVo0lyxq8aOCp?= =?us-ascii?Q?Zx4ILGzMdQQKfz1yrZzDpVmmHUZDsanbMXQHQUJuRfX+VvLXuj15OIM+SVgv?= =?us-ascii?Q?0qizKqX25MWiOA+9opzJm3QaPgr1C/Xu2OIK4RKSZJd9el6masdF8ywTT+Zo?= =?us-ascii?Q?AByaOZ2PeNQMf0xj+7pWvi6f9EJbg28XF3vtSJhnArg=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1647.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7a2fd33-c6ea-4aab-08e2-08d8b8567c3e X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2021 06:34:46.3423 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0pLI6/y78Kt5SsjNI6QR6xUGvyshs2glB7n614pSSPKwdrM/IgisLNhOF7zaMyP5qEj/ZVBo0B5WRldOIXLlfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1101MB2254 Return-Path: zhichao.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable There is no need to add [BUG] in the title. I would remove it when I create= the PR. If you want to have a record for this bug, you can edit a Bugzilla and add = the link in the commit message. Beside of that, Reviewed-by: Zhichao Gao Thanks, Zhichao > -----Original Message----- > From: gechao@greatwall.com.cn > Sent: Thursday, January 14, 2021 11:23 AM > To: Gao, Zhichao > Cc: devel@edk2.groups.io; Ni, Ray ; gechao > > Subject: [PATCH] MdeModulePkg/TerminalDxe [BUG]: Terminal fifo buffer > overflow. >=20 > From: gechao >=20 > Fix the bug of terminal fifo buffer overflow with UINT8 type. >=20 > typedef struct { > UINT8 Head; > UINT8 Tail; > UINT8 Data[RAW_FIFO_MAX_NUMBER + 1]; > } RAW_DATA_FIFO; > RAW_FIFO_MAX_NUMBER is 256. > the data buffer size is 257 (Index from 0 to 256), but the max value of t= he index, > Head or Tail (UINT8), is 255. That means the last data of the data buffer= would be > always empty if we use Head/Tail to output/input the data correctly. And > because of the incorrect buffer size the FIFO full check "((Tail + 1) % > (RAW_FIFO_MAX_NUMBER + 1)) =3D=3D Head" would never meet. >=20 > Signed-off-by: gechao > --- > MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > index 378ace13ce..360e58e847 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > @@ -37,7 +37,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include -#define RAW_FIFO_MAX_NUMBER 256+#define > RAW_FIFO_MAX_NUMBER 255 #define FIFO_MAX_NUMBER 128 typedef > struct {-- > 2.25.1