Linux-XFS Archive on lore.kernel.org
 help / color / Atom feed
From: Allison Collins <allison.henderson@oracle.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2 1/1] xfs: Fix Smatch warning in xfs_attr_node_get
Date: Wed, 29 Jul 2020 13:02:02 -0700
Message-ID: <2681bee9-5f9a-3132-60c8-09a5ab325623@oracle.com> (raw)
In-Reply-To: <20200729195916.GF3151642@magnolia>



On 7/29/20 12:59 PM, Darrick J. Wong wrote:
> On Tue, Jul 28, 2020 at 09:37:47PM -0700, Allison Collins wrote:
>> Fix warning: variable dereferenced before check 'state' in
>> xfs_attr_node_get.  If xfs_attr_node_hasname fails, it may return a null
>> state.  If state is null, do not release paths or derefrence state
>>
>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> 
> Looks ok, though I folded all these into the for-next rebase (and then
> forgot to push send on this...)
> 
No worries, thank you!
Allison

> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> --D
> 
>> ---
>>   fs/xfs/libxfs/xfs_attr.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
>> index e5ec9ed..38fe0d3 100644
>> --- a/fs/xfs/libxfs/xfs_attr.c
>> +++ b/fs/xfs/libxfs/xfs_attr.c
>> @@ -1422,7 +1422,7 @@ xfs_attr_node_get(
>>   	 * If not in a transaction, we have to release all the buffers.
>>   	 */
>>   out_release:
>> -	for (i = 0; i < state->path.active; i++) {
>> +	for (i = 0; i < state && state->path.active; i++) {
>>   		xfs_trans_brelse(args->trans, state->path.blk[i].bp);
>>   		state->path.blk[i].bp = NULL;
>>   	}
>> -- 
>> 2.7.4
>>

      reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29  4:37 Allison Collins
2020-07-29 19:59 ` Darrick J. Wong
2020-07-29 20:02   ` Allison Collins [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=2681bee9-5f9a-3132-60c8-09a5ab325623@oracle.com \
    --to=allison.henderson@oracle.com \
    --cc=darrick.wong@oracle.com \
    --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

Linux-XFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-xfs/0 linux-xfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-xfs linux-xfs/ https://lore.kernel.org/linux-xfs \
		linux-xfs@vger.kernel.org
	public-inbox-index linux-xfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-xfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git