From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 9395B2194235A for ; Mon, 10 Apr 2017 02:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491817695; x=1523353695; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=VfNPXJACUfZnrqD2x5Uk16Ed7bEE9CrrNEiKtS+CLSs=; b=l+6psy1o6EDYNeqBSR1s3B1Pd9s2T2TzzlkIl2vZJiDHGdha9wlywx6G AHPooaVs9ErYKymmTY9svYe4xoSnmg==; Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2017 02:48:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,182,1488873600"; d="scan'208";a="246683938" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 10 Apr 2017 02:48:15 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 10 Apr 2017 02:48:14 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 10 Apr 2017 02:48:15 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.224]) with mapi id 14.03.0319.002; Mon, 10 Apr 2017 17:48:12 +0800 From: "Zeng, Star" To: Guoheyi , "edk2-devel@lists.01.org" CC: "Tian, Feng" , "Zeng, Star" Thread-Topic: [edk2] [ScsiDiskDxe] Implict type conversion bug Thread-Index: AdKx3niUmwxWUOc0RKi079uw2sqbEwAAPgtw Date: Mon, 10 Apr 2017 09:48:11 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B879151@shsmsx102.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [ScsiDiskDxe] Implict type conversion bug 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: Mon, 10 Apr 2017 09:48:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hao has sent patch for this issue. You can search emails with title "[edk2] [PATCH] MdeModulePkg/ScsiDiskDxe: = Fix potential implicit sign extension". Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Guoh= eyi Sent: Monday, April 10, 2017 5:40 PM To: edk2-devel@lists.01.org Cc: Tian, Feng Subject: [edk2] [ScsiDiskDxe] Implict type conversion bug Hi folks, In MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c, Line 2757, we have the cod= e as below: ScsiDiskDevice->BlkIo.Media->LastBlock =3D (Capacity10->LastLba3 << 24= ) | (Capacity10->LastLba2 << 16) = | (Capacity10->LastLba1 << 8) = | Capacity10->LastLba0; However, we tested on VS2008 and found that the intermediate result would b= e convert to INT32 then INT64 implicitly, so the result will be sign extend= ed and LastBlock may not be assigned with what is expected. We can simply t= est LastLba3 >=3D 0x80 to see what will happen. Please let me know your comments. Thanks and regards, Gary (Heyi Guo) _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel