All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Eric Curtin <ericcurtin17@gmail.com>
Cc: Dave Chinner <david@fromorbit.com>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	Jan Kara <jack@suse.com>,
	linux-ext4@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	linux-nvdimm@lists.01.org,
	Matthew Wilcox <matthew.r.wilcox@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>
Subject: Re: [PATCH 2/2] ext2: Add locking for DAX faults
Date: Tue, 13 Oct 2015 16:15:30 -0600	[thread overview]
Message-ID: <20151013221530.GA17773@linux.intel.com> (raw)
In-Reply-To: <CANpvso6auD-NWsEYw10FNSviusA63tyK785usG=9R3r+a3Rirg@mail.gmail.com>

On Tue, Oct 13, 2015 at 12:35:44AM +0100, Eric Curtin wrote:
> Hi Ross,
> 
> For all those int ret declarations. Why not declare and initialize all
> on the same line?
> 
> Regards,
> Eric

Because the return value 'ret' is set unconditionally later in the function as
part of a call into the DAX code.  This call needs to be made after we've done
appropriate locking, though, which really is the point of the ext2 wrapper for
the DAX function.  Setting it to some random value and then unconditionally
overwriting it later in the function is a bad pattern because a) the initial
value is meaningless and b) it can hide coding errors where you are no longer
setting the variable to something meaningful.  The "warning: ‘ret’ is used
uninitialized in this function" warnings would otherwise warn you that you've
made a mistake.

WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Eric Curtin <ericcurtin17@gmail.com>
Cc: Dave Chinner <david@fromorbit.com>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	Jan Kara <jack@suse.com>,
	linux-ext4@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	linux-nvdimm@ml01.01.org,
	Matthew Wilcox <matthew.r.wilcox@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>
Subject: Re: [PATCH 2/2] ext2: Add locking for DAX faults
Date: Tue, 13 Oct 2015 16:15:30 -0600	[thread overview]
Message-ID: <20151013221530.GA17773@linux.intel.com> (raw)
In-Reply-To: <CANpvso6auD-NWsEYw10FNSviusA63tyK785usG=9R3r+a3Rirg@mail.gmail.com>

On Tue, Oct 13, 2015 at 12:35:44AM +0100, Eric Curtin wrote:
> Hi Ross,
> 
> For all those int ret declarations. Why not declare and initialize all
> on the same line?
> 
> Regards,
> Eric

Because the return value 'ret' is set unconditionally later in the function as
part of a call into the DAX code.  This call needs to be made after we've done
appropriate locking, though, which really is the point of the ext2 wrapper for
the DAX function.  Setting it to some random value and then unconditionally
overwriting it later in the function is a bad pattern because a) the initial
value is meaningless and b) it can hide coding errors where you are no longer
setting the variable to something meaningful.  The "warning: ‘ret’ is used
uninitialized in this function" warnings would otherwise warn you that you've
made a mistake.

  reply	other threads:[~2015-10-13 22:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 22:02 [PATCH 0/2] Add updated DAX locking to ext2 Ross Zwisler
2015-10-09 22:02 ` Ross Zwisler
2015-10-09 22:02 ` [PATCH 1/2] dax: dax_pfn_mkwrite() truncate race check Ross Zwisler
2015-10-09 22:02   ` Ross Zwisler
2015-10-09 22:02 ` [PATCH 2/2] ext2: Add locking for DAX faults Ross Zwisler
2015-10-09 22:02   ` Ross Zwisler
2015-10-09 22:18   ` Dan Williams
2015-10-09 22:18     ` Dan Williams
2015-10-09 22:38     ` Ross Zwisler
2015-10-09 22:38       ` Ross Zwisler
2015-10-11 23:14   ` Dave Chinner
2015-10-11 23:14     ` Dave Chinner
2015-10-12 17:21     ` Ross Zwisler
2015-10-12 17:21       ` Ross Zwisler
2015-10-12 23:02       ` Dave Chinner
2015-10-12 23:02         ` Dave Chinner
2015-10-12 21:41     ` Ross Zwisler
2015-10-12 21:41       ` Ross Zwisler
2015-10-12 23:24       ` Dave Chinner
2015-10-12 23:24         ` Dave Chinner
2015-10-12 23:35         ` Eric Curtin
2015-10-12 23:35           ` Eric Curtin
2015-10-13 22:15           ` Ross Zwisler [this message]
2015-10-13 22:15             ` Ross Zwisler
2015-10-13 15:02         ` Ross Zwisler
2015-10-13 15:02           ` Ross Zwisler
2015-10-13  8:07       ` Jan Kara
2015-10-13  8:07         ` Jan Kara
2015-10-13 17:33         ` Ross Zwisler
2015-10-13 17:33           ` Ross Zwisler
2015-10-13 17:47           ` Jan Kara
2015-10-13 17:47             ` Jan Kara

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=20151013221530.GA17773@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=andreas.dilger@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@fromorbit.com \
    --cc=ericcurtin17@gmail.com \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=matthew.r.wilcox@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.