public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Allison Henderson <allison.henderson@oracle.com>
To: Dave Chinner <david@fromorbit.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-xfs@vger.kernel.org, djwong@kernel.org
Subject: Re: [PATCH] xfs: perag may be null in xfs_imap()
Date: Thu, 10 Jun 2021 17:57:13 -0700	[thread overview]
Message-ID: <e375e2c9-5ebd-4430-e60a-11669f72da73@oracle.com> (raw)
In-Reply-To: <20210610223747.GR664593@dread.disaster.area>



On 6/10/21 3:37 PM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Dan Carpenter's static checker reported:
> 
> The patch 7b13c5155182: "xfs: use perag for ialloc btree cursors"
> from Jun 2, 2021, leads to the following Smatch complaint:
> 
>      fs/xfs/libxfs/xfs_ialloc.c:2403 xfs_imap()
>      error: we previously assumed 'pag' could be null (see line 2294)
> 
> And it's right. Fix it.
> 
> Fixes: 7b13c5155182 ("xfs: use perag for ialloc btree cursors")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
Looks ok
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>

> ---
>   fs/xfs/libxfs/xfs_ialloc.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 654a8d9681e1..57d9cb632983 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -2398,7 +2398,8 @@ xfs_imap(
>   	}
>   	error = 0;
>   out_drop:
> -	xfs_perag_put(pag);
> +	if (pag)
> +		xfs_perag_put(pag);
>   	return error;
>   }
>   
> 

      parent reply	other threads:[~2021-06-11  0:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  6:16 [bug report] xfs: use perag for ialloc btree cursors Dan Carpenter
2021-06-10 22:37 ` [PATCH] xfs: perag may be null in xfs_imap() Dave Chinner
2021-06-10 22:48   ` Darrick J. Wong
2021-06-11  0:57   ` Allison Henderson [this message]

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=e375e2c9-5ebd-4430-e60a-11669f72da73@oracle.com \
    --to=allison.henderson@oracle.com \
    --cc=dan.carpenter@oracle.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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