RE: [PATCH] block: Fix integer promotion error in bdrv_getlength()

2020-11-05 Thread Tuguoyi
On Wed, 2019-07-03 at 10:13 -0500, Eric Blake wrote: > On 11/5/20 2:31 AM, Max Reitz wrote: > > On 05.11.20 06:40, Tuguoyi wrote: > >> As BDRV_SECTOR_SIZE is of type uint64_t, the expression will > >> automatically convert the @ret to uint64_t. When an error code > >> returned from bdrv_nb_sectors(

Re: [PATCH] block: Fix integer promotion error in bdrv_getlength()

2020-11-05 Thread Eric Blake
On 11/5/20 7:26 AM, Max Reitz wrote: >> I actually preferred the v1 solution, rather than this v2, as it avoided >> a cast. > > I don’t, because it doesn’t make the ?: go away, so I prefer the less > invasive version. > > If you want to send your suggested version (that drops both ?:), I’m > hap

Re: [PATCH] block: Fix integer promotion error in bdrv_getlength()

2020-11-05 Thread Max Reitz
On 05.11.20 14:14, Eric Blake wrote: On 11/5/20 2:31 AM, Max Reitz wrote: On 05.11.20 06:40, Tuguoyi wrote: As BDRV_SECTOR_SIZE is of type uint64_t, the expression will automatically convert the @ret to uint64_t. When an error code returned from bdrv_nb_sectors(), the promoted @ret will be a ve

Re: [PATCH] block: Fix integer promotion error in bdrv_getlength()

2020-11-05 Thread Eric Blake
On 11/5/20 2:31 AM, Max Reitz wrote: > On 05.11.20 06:40, Tuguoyi wrote: >> As BDRV_SECTOR_SIZE is of type uint64_t, the expression will >> automatically convert the @ret to uint64_t. When an error code >> returned from bdrv_nb_sectors(), the promoted @ret will be a very >> large number, as a resul

Re: [PATCH] block: Fix integer promotion error in bdrv_getlength()

2020-11-05 Thread Max Reitz
On 05.11.20 06:40, Tuguoyi wrote: As BDRV_SECTOR_SIZE is of type uint64_t, the expression will automatically convert the @ret to uint64_t. When an error code returned from bdrv_nb_sectors(), the promoted @ret will be a very large number, as a result the -EFBIG will be returned which is not the re

[PATCH] block: Fix integer promotion error in bdrv_getlength()

2020-11-04 Thread Tuguoyi
As BDRV_SECTOR_SIZE is of type uint64_t, the expression will automatically convert the @ret to uint64_t. When an error code returned from bdrv_nb_sectors(), the promoted @ret will be a very large number, as a result the -EFBIG will be returned which is not the real error code. Signed-off-by: Guoyi