public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: shut up -Wuninitialized in xfsaild_push
Date: Tue, 29 Nov 2022 16:36:37 +1100	[thread overview]
Message-ID: <20221129053637.GC3600936@dread.disaster.area> (raw)
In-Reply-To: <166930917525.2061853.17523624187254825450.stgit@magnolia>

On Thu, Nov 24, 2022 at 08:59:35AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> -Wuninitialized complains about @target in xfsaild_push being
> uninitialized in the case where the waitqueue is active but there is no
> last item in the AIL to wait for.  I /think/ it should never be the case
> that the subsequent xfs_trans_ail_cursor_first returns a log item and
> hence we'll never end up at XFS_LSN_CMP, but let's make this explicit.

If xfs_ail_max() returns NULL, then xfs_trans_ail_cursor_first()
must return NULL as the AIL is empty. So we always jump out of the
code in that case, and never use an uninitialised target value.
Older compilers (gcc-11) don't complain about target being used
uninitialised, only newer, "smarter" versions.

FWIW, the patchset I have that reworks the AIL push
target/wakeup/grant head accounting completely reworks this target
code[1], so in the mean time doing this to shut up the compiler
warnings is fine.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

[1] https://lore.kernel.org/linux-xfs/20220809230353.3353059-1-david@fromorbit.com/

-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2022-11-29  5:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 16:59 [PATCHSET 0/3] xfs: fixes for 6.2 Darrick J. Wong
2022-11-24 16:59 ` [PATCH 1/3] xfs: invalidate block device page cache during unmount Darrick J. Wong
2022-11-29  2:36   ` Gao Xiang
2022-11-29  5:23   ` Dave Chinner
2022-11-29  5:59     ` Darrick J. Wong
2022-11-24 16:59 ` [PATCH 2/3] xfs: use memcpy, not strncpy, to format the attr prefix during listxattr Darrick J. Wong
2022-11-29  2:37   ` Gao Xiang
2022-11-29  5:26   ` Dave Chinner
2022-11-24 16:59 ` [PATCH 3/3] xfs: shut up -Wuninitialized in xfsaild_push Darrick J. Wong
2022-11-29  3:00   ` Gao Xiang
2022-11-29  5:36   ` Dave Chinner [this message]
2022-11-27 18:36 ` [PATCH 4/3] xfs: attach dquots to inode before reading data/cow fork mappings Darrick J. Wong
2022-11-29  6:31   ` Dave Chinner
2022-11-29  6:50     ` Darrick J. Wong
2022-11-29  8:04       ` Dave Chinner
2022-11-29 21:03         ` Darrick J. Wong
2022-11-29 21:05   ` [PATCH v2 " Darrick J. Wong
2022-11-29 21:38     ` Dave Chinner

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=20221129053637.GC3600936@dread.disaster.area \
    --to=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