Received: by 10.223.185.116 with SMTP id b49csp2096704wrg; Thu, 22 Feb 2018 08:06:28 -0800 (PST) X-Google-Smtp-Source: AH8x224mbUjEeKIdljNvIlzlR5U4dJfVVGSDAAsI0f1IKfHUomPTI87Hq67g6gZI75ZBkUg+bvZn X-Received: by 10.99.64.196 with SMTP id n187mr6040157pga.147.1519315588125; Thu, 22 Feb 2018 08:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519315588; cv=none; d=google.com; s=arc-20160816; b=yv7gVKLq4q7mvpuZFyQt0QCjBOTBcaPJkEZr7CVmduSGARk0Vk8xkjUes2m0pO7h9P 2fB8D4dbNZzl1MSL7E3j+L1kHMARR8jjQDAE3t94eD/nf9RZtbU6SxxHEV9jj3ChVzQb RI4Zei5FCh3GVDjjeQ0EpQ7E1g2WuOb+RfyE4aca6NvdvhYeaT+5uf1EfTUlOTZIK0sx 5/oZNZDqwXdpl8++pHO2DHUtGbaUXgV4/xE7dnZuU7uDMbP3a+zrVzCdqobroWhCoJwy zf4MVllqLKtqfYeJerauBj9+TI/dsNAiaD6WUueOWZG9MHTgGDjRB9H7IqajdgBrPvR5 +ATQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=CCPJ+RaInTh9OAUQU64Fi5DG1YSQW+cpcBEwu+QyoYo=; b=0jIM8FPkdSV1Thq4ohy6ro7twxbZYm3jqCvjwzUMAamdRwwNzlNCX0X53JOEosViVD NYtCYCyD13Wdj8dAC9L4iXzz79mPD6DGxF8M3a09OcP3PpSm0iaaTCXuUDT1wKgDuix6 y9Zd7Gj8AJ778Oxkqu2iMtri8ku4d7WRn4NDw0mpCEStXn1Fjq5WIcf9GFp2aaeZDC85 OH9tIx9AN6Trp69q9mm4UTZLIB/Sg6IHzNnqdPsgw+WkrkznBF+NhHMCJ4Hm6egQaCg2 wI2HwmTg6aePtUOOrQ1IIkO6nYbLodmYjVZI8j0jxuUD5l3/xOaAwKoBWXQa0IUYthC0 MM2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f91-v6si223276plf.498.2018.02.22.08.06.13; Thu, 22 Feb 2018 08:06:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933261AbeBVQEg (ORCPT + 99 others); Thu, 22 Feb 2018 11:04:36 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39004 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933029AbeBVQEe (ORCPT ); Thu, 22 Feb 2018 11:04:34 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 950148182D0C; Thu, 22 Feb 2018 16:04:33 +0000 (UTC) Received: from localhost (unknown [10.18.25.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D3EE2026987; Thu, 22 Feb 2018 16:04:33 +0000 (UTC) Date: Thu, 22 Feb 2018 11:04:32 -0500 From: Mike Snitzer To: Arnd Bergmann Cc: Alasdair Kergon , dm-devel@redhat.com, Mikulas Patocka , Ingo Molnar , Aliaksei Karaliou , Jens Axboe , Jan Kara , Dan Carpenter , Mark Rutland , Eric Biggers , linux-kernel@vger.kernel.org Subject: Re: dm-bufio: avoid false-positive Wmaybe-uninitialized warning Message-ID: <20180222160432.GA16971@redhat.com> References: <20180222155627.1800948-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180222155627.1800948-1-arnd@arndb.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 22 Feb 2018 16:04:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 22 Feb 2018 16:04:33 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'msnitzer@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 22 2018 at 10:56am -0500, Arnd Bergmann wrote: > gcc-6.3 and earlier show a new warning after a seemingly unrelated change > to the arm64 PAGE_KERNEL definition: > > In file included from drivers/md/dm-bufio.c:14:0: > drivers/md/dm-bufio.c: In function 'alloc_buffer': > include/linux/sched/mm.h:182:56: warning: 'noio_flag' may be used uninitialized in this function [-Wmaybe-uninitialized] > current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags; > ^ > > The same warning happened earlier on linux-3.18 for MIPS and I did a > workaround for that, but now it's come back. > > gcc-7 and newer are apparently smart enough to figure this out, and > other architectures don't show it, so the best I could come up with is > to rework the caller slightly in a way that makes it obvious enough to > all arm64 compilers what is happening here. > > Fixes: 41acec624087 ("arm64: kpti: Make use of nG dependent on arm64_kernel_unmapped_at_el0()") > Link: https://patchwork.kernel.org/patch/9692829/ > Signed-off-by: Arnd Bergmann > --- > drivers/md/dm-bufio.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c > index 414c9af54ded..e7ad6fc6a5ea 100644 > --- a/drivers/md/dm-bufio.c > +++ b/drivers/md/dm-bufio.c > @@ -413,13 +413,13 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask, > * as if GFP_NOIO was specified. > */ > > - if (gfp_mask & __GFP_NORETRY) > + if (gfp_mask & __GFP_NORETRY) { > noio_flag = memalloc_noio_save(); > - > - ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL); > - > - if (gfp_mask & __GFP_NORETRY) > + ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL); > memalloc_noio_restore(noio_flag); > + } else { > + ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL); > + } > > return ptr; > } Mikulas already sent a fix for this: https://patchwork.kernel.org/patch/10211631/ But I like yours a bit better, though I'll likely move the declaration of 'noio_flag' temporary inside the conditional. Anyway, I'll get this fixed up shortly, thanks. Mike