[U-Boot] [PATCH 2/3] nvme: Fix potential sign extension issue in nvme_blk_rw()
Tom Rini
trini at konsulko.com
Sat Sep 2 15:23:25 UTC 2017
On Sat, Sep 02, 2017 at 08:15:36AM -0700, Bin Meng wrote:
> "lbas" with type "u16" (16 bits, unsigned) is promoted in
> "lbas << ns->lba_shift" to type "int" (32 bits, signed), then
> sign-extended to type "unsigned long long" (64 bits, unsigned).
> If "lbas << ns->lba_shift" is greater than 0x7FFFFFFF, the upper
> bits of the result will all be 1.
>
> Fix it by casting "lbas" to "u32".
>
> Reported-by: Coverity (CID: 166730)
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
Reviewed-by: Tom Rini <trini at konsulko.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170902/ea786043/attachment.sig>
More information about the U-Boot
mailing list