linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build warning after merge of the percpu tree
@ 2017-06-21  5:20 Stephen Rothwell
  2017-06-21 15:51 ` [PATCH 1/1] percpu: resolve err may not be initialized in pcpu_alloc Dennis Zhou
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2017-06-21  5:20 UTC (permalink / raw)
  To: Tejun Heo, Christoph Lameter, Ingo Molnar
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Dennis Zhou

Hi all,

After merging the percpu tree, today's linux-next build (arm
multi_v7_defconfig) produced this warning:

In file included from include/linux/kernel.h:13:0,
                 from include/linux/bitmap.h:9,
                 from mm/percpu.c:58:
mm/percpu.c: In function 'pcpu_alloc':
include/linux/printk.h:303:2: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
  printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
  ^
mm/percpu.c:864:14: note: 'err' was declared here
  const char *err;
              ^

I am not sure which commit introduced this, although the

	if (is_atomic)
		goto fail;

in pcpu_alloc() looks suspicious.

-- 
Cheers,
Stephen Rothwell

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] percpu: resolve err may not be initialized in pcpu_alloc
  2017-06-21  5:20 linux-next: build warning after merge of the percpu tree Stephen Rothwell
@ 2017-06-21 15:51 ` Dennis Zhou
  2017-06-21 16:02   ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Dennis Zhou @ 2017-06-21 15:51 UTC (permalink / raw)
  To: Stephen Rothwell, Tejun Heo
  Cc: Christoph Lameter, Ingo Molnar, Linux-Next Mailing List,
	Linux Kernel Mailing List

>From 4a42ecc735cff0015cc73c3d87edede631f4b885 Mon Sep 17 00:00:00 2001
From: Dennis Zhou <dennisz@fb.com>
Date: Wed, 21 Jun 2017 08:07:15 -0700

Add error message to out of space failure for atomic allocations in
percpu allocation path to fix -Wmaybe-uninitialized.

Signed-off-by: Dennis Zhou <dennisz@fb.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 mm/percpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index a5bc363..bd4130a 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -956,8 +956,10 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
 	 * tasks to create chunks simultaneously.  Serialize and create iff
 	 * there's still no empty chunk after grabbing the mutex.
 	 */
-	if (is_atomic)
+	if (is_atomic) {
+		err = "atomic alloc failed, no space left";
 		goto fail;
+	}
 
 	if (list_empty(&pcpu_slot[pcpu_nr_slots - 1])) {
 		chunk = pcpu_create_chunk();
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] percpu: resolve err may not be initialized in pcpu_alloc
  2017-06-21 15:51 ` [PATCH 1/1] percpu: resolve err may not be initialized in pcpu_alloc Dennis Zhou
@ 2017-06-21 16:02   ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2017-06-21 16:02 UTC (permalink / raw)
  To: Dennis Zhou
  Cc: Stephen Rothwell, Christoph Lameter, Ingo Molnar,
	Linux-Next Mailing List, Linux Kernel Mailing List

On Wed, Jun 21, 2017 at 11:51:09AM -0400, Dennis Zhou wrote:
> From 4a42ecc735cff0015cc73c3d87edede631f4b885 Mon Sep 17 00:00:00 2001
> From: Dennis Zhou <dennisz@fb.com>
> Date: Wed, 21 Jun 2017 08:07:15 -0700
> 
> Add error message to out of space failure for atomic allocations in
> percpu allocation path to fix -Wmaybe-uninitialized.
> 
> Signed-off-by: Dennis Zhou <dennisz@fb.com>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>

Applied to percpu/for-4.13.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-21 16:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21  5:20 linux-next: build warning after merge of the percpu tree Stephen Rothwell
2017-06-21 15:51 ` [PATCH 1/1] percpu: resolve err may not be initialized in pcpu_alloc Dennis Zhou
2017-06-21 16:02   ` Tejun Heo

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