linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: Fix error code in 'xfs_ioc_getbmap()'
@ 2018-10-17  6:21 Christophe JAILLET
  2018-10-17  8:41 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2018-10-17  6:21 UTC (permalink / raw)
  To: darrick.wong; +Cc: linux-xfs, linux-kernel, kernel-janitors, Christophe JAILLET

In this function, once 'buf' has been allocated, we unconditionally
return 0.
However, 'error' is set to some error codes in several error handling
paths.
Before commit 232b51948b99 ("xfs: simplify the xfs_getbmap interface")
this was not an issue because all error paths were returning directly,
but now that some cleanup at the end may be needed, we must propagate the
error code.

Fixes: 232b51948b99 ("xfs: simplify the xfs_getbmap interface")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 fs/xfs/xfs_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 0ef5ece5634c..bad90479ade2 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1616,7 +1616,7 @@ xfs_ioc_getbmap(
 	error = 0;
 out_free_buf:
 	kmem_free(buf);
-	return 0;
+	return error;
 }
 
 struct getfsmap_info {
-- 
2.17.1


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

* Re: [PATCH] xfs: Fix error code in 'xfs_ioc_getbmap()'
  2018-10-17  6:21 [PATCH] xfs: Fix error code in 'xfs_ioc_getbmap()' Christophe JAILLET
@ 2018-10-17  8:41 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2018-10-17  8:41 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: darrick.wong, linux-xfs, linux-kernel, kernel-janitors

On Wed, Oct 17, 2018 at 08:21:38AM +0200, Christophe JAILLET wrote:
> In this function, once 'buf' has been allocated, we unconditionally
> return 0.
> However, 'error' is set to some error codes in several error handling
> paths.
> Before commit 232b51948b99 ("xfs: simplify the xfs_getbmap interface")
> this was not an issue because all error paths were returning directly,
> but now that some cleanup at the end may be needed, we must propagate the
> error code.
> 
> Fixes: 232b51948b99 ("xfs: simplify the xfs_getbmap interface")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

end of thread, other threads:[~2018-10-17  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17  6:21 [PATCH] xfs: Fix error code in 'xfs_ioc_getbmap()' Christophe JAILLET
2018-10-17  8:41 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).