Re: [PATCH for-5.2] block/export/vhost-user-blk-server.c: Avoid potential integer overflow

2020-11-10 Thread Stefan Hajnoczi
On Mon, Nov 09, 2020 at 04:16:45PM +0100, Max Reitz wrote: > [Cc-ing Stefan] > > On 09.11.20 16:05, Peter Maydell wrote: > > In vu_blk_discard_write_zeroes(), we read a 32-bit sector count from > > the descriptor and convert it to a 64-bit byte count. Coverity warns > > that the left shift is done

Re: [PATCH for-5.2] block/export/vhost-user-blk-server.c: Avoid potential integer overflow

2020-11-09 Thread Max Reitz
[Cc-ing Stefan] On 09.11.20 16:05, Peter Maydell wrote: In vu_blk_discard_write_zeroes(), we read a 32-bit sector count from the descriptor and convert it to a 64-bit byte count. Coverity warns that the left shift is done with 32-bit arithmetic so it might overflow before the conversion to 64-bi

[PATCH for-5.2] block/export/vhost-user-blk-server.c: Avoid potential integer overflow

2020-11-09 Thread Peter Maydell
In vu_blk_discard_write_zeroes(), we read a 32-bit sector count from the descriptor and convert it to a 64-bit byte count. Coverity warns that the left shift is done with 32-bit arithmetic so it might overflow before the conversion to 64-bit happens. Add a cast to avoid this. Fixes: Coverity CID 1