On 06/09/2017 09:30 AM, Bart Van Assche wrote:
> On 06/08/17 04:46, Hannes Reinecke wrote:
>> if (lo->lo_offset != info->lo_offset ||
>> - lo->lo_sizelimit != info->lo_sizelimit)
>> - if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) {
>> + lo->lo_sizelimit != info->lo_sizelimit ||
>> + lo->lo_flags != lo_flags ||
>> + ((lo->lo_flags & LO_FLAGS_BLOCKSIZE) &&
>> + lo->lo_logical_blocksize != LO_INFO_BLOCKSIZE(info))) {
>> + if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit,
>> + LO_INFO_BLOCKSIZE(info)))
>> err = -EFBIG;
>> goto exit;
>> }
>
> Hello Hannes and Jens,
>
> gcc reports the following for the above code:
>
> drivers/block/loop.c:1149:3: warning: this 'if' clause does not guard...
> [-Wmisleading-indentation]
>
> Please review this code. Have the braces perhaps been misplaced?
It's clearly buggy, fix has gone in:
http://git.kernel.dk/cgit/linux-block/commit/?h=for-4.13/block&id=b040ad9cf6a169cc000a5324fcada695dfa1f4b3
--
Jens Axboe