public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Guoheyi <guoheyi@huawei.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Feng Tian <feng.tian@intel.com>, Feng Tian <feng.tian@intel.com>
Subject: [ScsiDiskDxe] Implict type conversion bug
Date: Mon, 10 Apr 2017 09:40:25 +0000	[thread overview]
Message-ID: <B328F08581D714418202ABF306D3781C3AC13686@DGGEMA505-MBS.china.huawei.com> (raw)

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)


             reply	other threads:[~2017-04-10  9:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10  9:40 Guoheyi [this message]
2017-04-10  9:48 ` [ScsiDiskDxe] Implict type conversion bug Zeng, Star
2017-04-11  4:24   ` 答复: " Guoheyi
2017-04-11  7:05   ` Guoheyi
2017-04-11  7:13     ` Wu, Hao A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B328F08581D714418202ABF306D3781C3AC13686@DGGEMA505-MBS.china.huawei.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox