From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 398C421EC8D09 for ; Wed, 27 Sep 2017 21:29:03 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 27 Sep 2017 21:32:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,448,1500966000"; d="scan'208";a="1224629802" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.13]) by fmsmga002.fm.intel.com with ESMTP; 27 Sep 2017 21:32:15 -0700 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Steven Shi , Michael Kinney , Liming Gao , Star Zeng , Eric Dong , Fu Siyuan , Ye Ting , Wu Jiaxin , Qin Long , Paolo Bonzini Date: Thu, 28 Sep 2017 12:32:08 +0800 Message-Id: <20170928043213.20776-1-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 Subject: [PATCH v3 0/5] Resolve undefined behaviours in left shift OPs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 04:29:05 -0000 Based on the feedbacks from Liming, the V3 series drops the patch for MdeModulePkg/Crc32. Since the left shift operation "1 << Index" will be removed by an under-reviewing patch series: [Patch 0/2] Add CalculateCrc32() API in MdePkg BaseLib V2 history: According to the feebacks from Paolo, the following changes are made in this version of patch series: a. Refine the code logic in Tpl.c to void left shifting the negative value. Also makes the code more readable; b. Remove the '~' operator before 'Time.Hour' in DxeNetLib.c, since it seems like an implementation choice for generating the seed; c. Use '1U' instead of '(UINT32)1' in Crc32.c. V1 history: The series resolves two kinds of undefined behaviours in left shift operations: a. Left-shifting negative values; b. Left-shifting that incurs the result being out of range. Cc: Steven Shi Cc: Michael Kinney Cc: Liming Gao Cc: Star Zeng Cc: Eric Dong Cc: Fu Siyuan Cc: Ye Ting Cc: Wu Jiaxin Cc: Qin Long Cc: Paolo Bonzini Hao Wu (5): MdePkg/PrintLib: Fix possible negative value left shift MdeModulePkg/PrintLib: Fix possible negative value left shift MdeModulePkg/Tpl: Fix negative value left shift MdeModulePkg/DxeNetLib: Fix negative value left shift MdeModulePkg/AtaAtapiPassThru: Fix possible out of range left shift MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 4 ++-- MdeModulePkg/Core/Dxe/Event/Tpl.c | 12 +++++++++--- MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 2 +- MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c | 2 +- MdePkg/Library/BasePrintLib/PrintLibInternal.c | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) -- 2.12.0.windows.1