Received: by 10.213.65.68 with SMTP id h4csp432981imn; Tue, 13 Mar 2018 08:54:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELuA7pxPkQvLYR5YREywjDdUCQfkrGiobOJ+zDO/mxmOlxgKkx/PHPGwh/VwVJIj+XdUZd6S X-Received: by 10.98.204.132 with SMTP id j4mr1087681pfk.35.1520956485643; Tue, 13 Mar 2018 08:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956485; cv=none; d=google.com; s=arc-20160816; b=08O1qZ9PKd69hY0a4itoQXMt6d/jIdFaan4pQLN9rsdY8a0g+7fVBFKnwr7fm+RAld fCQC/3DRHtDZIxzws8Z1XbzG96s7ta5OsuIPwp3SU6gEbsIAX15y0JpIANviNLBeAQT6 SdwloSpcaZQEhNa6FI5j56/7df6KGAsRruB7gTwh/enDLQdDbV5Utogp7SdwbrLWYZPP zUlBKTC/LOnCw5O6vq8tN7a18f5gjOGyOkIf69fayiKi6hAN734tCf/qt4kZrHn4jfx/ KFJeQPd0+sYuHCke1MJXFIoWHgLQClZB2yJA1tF+sZxkrL3tyH8kAtd5OLd3qoC35ipa wQ+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=zwMT6G2CIjo0qgVSMWf8qnx3PULdAhWaTlv5BOE9uVI=; b=Tffo9n9jaIjnk7k029Ua9NmLtkQFGNPdDXZacXlcPrN4KOQL9SfGFUTTO0wTzyxott okP31eNJIdK2BgTyAoxbvxVd0DKFeXc89IFuJf/LsiIxu6088ammRlq8Q+BfTaEVdyY9 DTf6cyR8KpY5JLpg0alwy6SAIlcIAJxWuySgUAhlwMSDx09YL0xbGlO7lmLrUgx4W/HS S7XIjj6yWRygBAHRz2wCkBPonYtGjXRcVjyj6Ys0JLiBCalZesl5wAHJNZEavVGl/9ri d45QFfTiHTHR0F6/rXgdjb5QknrjGONJ8sIS96Uy738AitJLtT5vepb9o9GdBKF/btnX 0eUg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 197si297742pge.78.2018.03.13.08.54.31; Tue, 13 Mar 2018 08:54:45 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934829AbeCMPxI (ORCPT + 99 others); Tue, 13 Mar 2018 11:53:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35320 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934721AbeCMPjY (ORCPT ); Tue, 13 Mar 2018 11:39:24 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BE6FCFCF; Tue, 13 Mar 2018 15:39:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Mike Snitzer Subject: [PATCH 4.14 093/140] dm bufio: avoid false-positive Wmaybe-uninitialized warning Date: Tue, 13 Mar 2018 16:24:56 +0100 Message-Id: <20180313152504.405779344@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 590347e4000356f55eb10b03ced2686bd74dab40 upstream. 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/ Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann [snitzer: moved declarations inside conditional, altered vmalloc return] Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-bufio.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -386,9 +386,6 @@ static void __cache_size_refresh(void) static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask, enum data_mode *data_mode) { - unsigned noio_flag; - void *ptr; - if (c->block_size <= DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT) { *data_mode = DATA_MODE_SLAB; return kmem_cache_alloc(DM_BUFIO_CACHE(c), gfp_mask); @@ -412,16 +409,15 @@ static void *alloc_buffer_data(struct dm * all allocations done by this process (including pagetables) are done * as if GFP_NOIO was specified. */ + if (gfp_mask & __GFP_NORETRY) { + unsigned noio_flag = memalloc_noio_save(); + void *ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL); - if (gfp_mask & __GFP_NORETRY) - noio_flag = memalloc_noio_save(); - - ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL); - - if (gfp_mask & __GFP_NORETRY) memalloc_noio_restore(noio_flag); + return ptr; + } - return ptr; + return __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL); } /*