mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] loop: fix error handling regression
@ 2017-06-09 10:19 Arnd Bergmann
  2017-06-09 14:19 ` Jens Axboe
  2017-06-10  8:04 ` Hannes Reinecke
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-06-09 10:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Arnd Bergmann, Ming Lei, Hannes Reinecke, Omar Sandoval, linux-kernel

gcc points out an unusual indentation:

drivers/block/loop.c: In function 'loop_set_status':
drivers/block/loop.c:1149:3: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
   if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit,
   ^~
drivers/block/loop.c:1152:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    goto exit;

This was introduced by a new feature that accidentally moved the opening
braces from one condition to another. Adding a second pair of braces
makes it work correctly again and also more readable.

Fixes: f2c6df7dbf9a ("loop: support 4k physical blocksize")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/block/loop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 4d376c10a97a..e288fb30100f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1147,10 +1147,11 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
 	    ((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)))
+				     LO_INFO_BLOCKSIZE(info))) {
 			err = -EFBIG;
 			goto exit;
 		}
+	}
 
 	loop_config_discard(lo);
 
-- 
2.9.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] loop: fix error handling regression
  2017-06-09 10:19 [PATCH] loop: fix error handling regression Arnd Bergmann
@ 2017-06-09 14:19 ` Jens Axboe
  2017-06-10  8:04 ` Hannes Reinecke
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2017-06-09 14:19 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Ming Lei, Hannes Reinecke, Omar Sandoval, linux-kernel

On 06/09/2017 04:19 AM, Arnd Bergmann wrote:
> gcc points out an unusual indentation:
> 
> drivers/block/loop.c: In function 'loop_set_status':
> drivers/block/loop.c:1149:3: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
>    if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit,
>    ^~
> drivers/block/loop.c:1152:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
>     goto exit;
> 
> This was introduced by a new feature that accidentally moved the opening
> braces from one condition to another. Adding a second pair of braces
> makes it work correctly again and also more readable.

Thanks for fixing this Arnd, I did notice (and complained to Hannes) this
yesterday. Added.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] loop: fix error handling regression
  2017-06-09 10:19 [PATCH] loop: fix error handling regression Arnd Bergmann
  2017-06-09 14:19 ` Jens Axboe
@ 2017-06-10  8:04 ` Hannes Reinecke
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2017-06-10  8:04 UTC (permalink / raw)
  To: Arnd Bergmann, Jens Axboe; +Cc: Ming Lei, Omar Sandoval, linux-kernel

On 06/09/2017 12:19 PM, Arnd Bergmann wrote:
> gcc points out an unusual indentation:
> 
> drivers/block/loop.c: In function 'loop_set_status':
> drivers/block/loop.c:1149:3: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
>    if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit,
>    ^~
> drivers/block/loop.c:1152:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
>     goto exit;
> 
> This was introduced by a new feature that accidentally moved the opening
> braces from one condition to another. Adding a second pair of braces
> makes it work correctly again and also more readable.
> 
> Fixes: f2c6df7dbf9a ("loop: support 4k physical blocksize")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/block/loop.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 4d376c10a97a..e288fb30100f 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1147,10 +1147,11 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
>  	    ((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)))
> +				     LO_INFO_BLOCKSIZE(info))) {
>  			err = -EFBIG;
>  			goto exit;
>  		}
> +	}
>  
>  	loop_config_discard(lo);
>  
> 
Oops. You are correct, of course.

Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-10  8:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 10:19 [PATCH] loop: fix error handling regression Arnd Bergmann
2017-06-09 14:19 ` Jens Axboe
2017-06-10  8:04 ` Hannes Reinecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®