mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + nvdimm-avoid-bogus-wmaybe-uninitialized-warning.patch added to -mm tree
@ 2017-08-01 21:45 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2017-08-01 21:45 UTC (permalink / raw)
  To: arnd, dan.j.williams, hch, jthumshirn, toshi.kani,
	vishal.l.verma, mm-commits


The patch titled
     Subject: nvdimm: avoid bogus -Wmaybe-uninitialized warning
has been added to the -mm tree.  Its filename is
     nvdimm-avoid-bogus-wmaybe-uninitialized-warning.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/nvdimm-avoid-bogus-wmaybe-uninitialized-warning.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/nvdimm-avoid-bogus-wmaybe-uninitialized-warning.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Arnd Bergmann <arnd@arndb.de>
Subject: nvdimm: avoid bogus -Wmaybe-uninitialized warning

Removing the btt_rw_page/pmem_rw_page functions has a surprising
side-effect of introducing a false-positive warning in another function,
due to changed inlining decisions in gcc:

In file included from drivers/nvdimm/pmem.c:36:0:
drivers/nvdimm/pmem.c: In function 'pmem_make_request':
drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/nvdimm/pmem.c:174:16: note: 'start' was declared here
In file included from drivers/nvdimm/btt.c:27:0:
drivers/nvdimm/btt.c: In function 'btt_make_request':
drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/nvdimm/btt.c:1202:16: note: 'start' was declared here

The problem is that gcc fails to track the value of the 'do_acct' variable
here and has to read it back from stack, but it does remember that 'start'
may be uninitialized sometimes.

This shuts up the warning by making nd_iostat_start() always initialize
the 'start' variable.  In those cases that gcc successfully tracks the
state of the variable, this will have no effect.

Link: http://lkml.kernel.org/r/20170801114926.1171418-1-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/nvdimm/nd.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -puN drivers/nvdimm/nd.h~nvdimm-avoid-bogus-wmaybe-uninitialized-warning drivers/nvdimm/nd.h
--- a/drivers/nvdimm/nd.h~nvdimm-avoid-bogus-wmaybe-uninitialized-warning
+++ a/drivers/nvdimm/nd.h
@@ -392,8 +392,10 @@ static inline bool nd_iostat_start(struc
 {
 	struct gendisk *disk = bio->bi_bdev->bd_disk;
 
-	if (!blk_queue_io_stat(disk->queue))
+	if (!blk_queue_io_stat(disk->queue)) {
+		*start = 0;
 		return false;
+	}
 
 	*start = jiffies;
 	generic_start_io_acct(bio_data_dir(bio),
_

Patches currently in -mm which might be from arnd@arndb.de are

kasan-avoid-wmaybe-uninitialized-warning-v3.patch
adfs-use-unsigned-types-for-memcpy-length.patch
nvdimm-avoid-bogus-wmaybe-uninitialized-warning.patch
fscache-fix-fscache_objlist_show-format-processing.patch
ib-mlx4-fix-sprintf-format-warning.patch
iopoll-avoid-wint-in-bool-context-warning.patch
kbuild-use-fshort-wchar-globally.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-01 21:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-01 21:45 + nvdimm-avoid-bogus-wmaybe-uninitialized-warning.patch added to -mm tree akpm

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).