From: David Sterba <dsterba@suse.cz>
To: Luis de Bethencourt <luisbg@osg.samsung.com>
Cc: linux-kernel@vger.kernel.org, clm@fb.com, jbacik@fb.com,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: reada: Fix returned errno code
Date: Wed, 23 Sep 2015 10:42:19 +0200 [thread overview]
Message-ID: <20150923084219.GR12815@suse.cz> (raw)
In-Reply-To: <c4a7a8023880c4a11326a6f7d9cc07ae37c12b0d.1442939007.git.luis@debethencourt.com>
On Tue, Sep 22, 2015 at 05:29:39PM +0100, Luis de Bethencourt wrote:
> reada is using -1 instead of the -ENOMEM defined macro to specify that
> a buffer allocation failed. Since the error number is propagated, the
> caller will get a -EPERM which is the wrong error condition.
>
> Smatch tool warning:
> reada_add_block() warn: returning -1 instead of -ENOMEM is sloppy
>
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
> fs/btrfs/reada.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index 4645cd1..5bfd3cd 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -569,7 +569,7 @@ static int reada_add_block(struct reada_control *rc, u64 logical,
> rec = kzalloc(sizeof(*rec), GFP_NOFS);
> if (!rec) {
> reada_extent_put(root->fs_info, re);
> - return -1;
> + return -ENOMEM;
When called from btrfs_reada_add, the return value is ignored and
overriden as ENOMEM. Please also update the caller to return the exact
value from reada_add_block.
next prev parent reply other threads:[~2015-09-23 8:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-22 16:29 [PATCH 0/2] btrfs: Fix returned errno codes Luis de Bethencourt
2015-09-22 16:29 ` [PATCH 1/2] btrfs: check-integrity: " Luis de Bethencourt
2015-09-23 8:47 ` David Sterba
2015-09-22 16:29 ` [PATCH 2/2] btrfs: reada: Fix returned errno code Luis de Bethencourt
2015-09-23 8:42 ` David Sterba [this message]
2015-09-23 8:50 ` [PATCH 0/2] btrfs: Fix returned errno codes David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150923084219.GR12815@suse.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luisbg@osg.samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).