public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [ScsiDiskDxe] Implict type conversion bug
@ 2017-04-10  9:40 Guoheyi
  2017-04-10  9:48 ` Zeng, Star
  0 siblings, 1 reply; 5+ messages in thread
From: Guoheyi @ 2017-04-10  9:40 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Feng Tian, Feng Tian

Hi folks,

In MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c, Line 2757, we have the code as below:

    ScsiDiskDevice->BlkIo.Media->LastBlock =  (Capacity10->LastLba3 << 24) |
                                              (Capacity10->LastLba2 << 16) |
                                              (Capacity10->LastLba1 << 8)  |
                                               Capacity10->LastLba0;

However, we tested on VS2008 and found that the intermediate result would be convert to INT32 then INT64 implicitly, so the result will be sign extended and LastBlock may not be assigned with what is expected. We can simply test LastLba3 >= 0x80 to see what will happen.

Please let me know your comments.

Thanks and regards,

Gary (Heyi Guo)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-11  7:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-10  9:40 [ScsiDiskDxe] Implict type conversion bug Guoheyi
2017-04-10  9:48 ` Zeng, Star
2017-04-11  4:24   ` 答复: " Guoheyi
2017-04-11  7:05   ` Guoheyi
2017-04-11  7:13     ` Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox