aboutsummaryrefslogtreecommitdiff
path: root/linux-headers
diff options
context:
space:
mode:
authorStefano Garzarella <sgarzare@redhat.com>2024-07-12 17:38:57 +0200
committerMichael S. Tsirkin <mst@redhat.com>2024-07-21 14:45:56 -0400
commit99d7c1b99a3fdb69213c09da6b7614243f877bee (patch)
treef18d93941ea495e29bfa466a45a23e3055040cef /linux-headers
parent0b0bb34f342f04ab8255a64edb7c6aec7105dc94 (diff)
downloadqemu-99d7c1b99a3fdb69213c09da6b7614243f877bee.zip
qemu-99d7c1b99a3fdb69213c09da6b7614243f877bee.tar.gz
qemu-99d7c1b99a3fdb69213c09da6b7614243f877bee.tar.bz2
contrib/vhost-user-blk: fix overflowing expression
Coverity reported: >>> CID 1549454: Integer handling issues (OVERFLOW_BEFORE_WIDEN) >>> Potentially overflowing expression "le32_to_cpu(desc->num_sectors) << 9" with type "uint32_t" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned). 199 le32_to_cpu(desc->num_sectors) << 9 }; Coverity noticed this issue after commit ab04420c3 ("contrib/vhost-user-*: use QEMU bswap helper functions"), but it was pre-existing and introduced from the beginning by commit caa1ee4313 ("vhost-user-blk: add discard/write zeroes features support"). Explicitly cast the 32-bit value before the shift to fix this issue. Fixes: Coverity CID 1549454 Fixes: 5ab04420c3 ("contrib/vhost-user-*: use QEMU bswap helper functions") Fixes: caa1ee4313 ("vhost-user-blk: add discard/write zeroes features support") Cc: changpeng.liu@intel.com Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20240712153857.207440-1-sgarzare@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'linux-headers')
0 files changed, 0 insertions, 0 deletions