Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp74975imm; Fri, 25 May 2018 14:35:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoRSFdem3nLKCKt1cj5+r9yELf5hu/qkKsviMMNDAbzavCOB5F4jVnI/U95k6OMpq6MmS1k X-Received: by 2002:a17:902:6b04:: with SMTP id o4-v6mr4222788plk.101.1527284105106; Fri, 25 May 2018 14:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527284105; cv=none; d=google.com; s=arc-20160816; b=z5gWm4TzCoZbEJQje+Cytk1Ah9mBnhwat5hYtq0/iRXg4YNxEEZtX7eWayVP0wcdfI AEdVW8T+m34N9EHK068aKGn7CT09nLAIMAsVmLpjs7KquLYBwN24cHTt2gSMScKlkrTK DK6ZHhRK30xSfcWC5PE/Ir+xlgjcyeyx7e2h+fGJCOSqDEZY2ZxXsQaEUzjyvYHwV+Gy q8HS6wZ6a6syvkKAR2Rpsk0NmMUyGnHHTjdXAHqVUQHyjJTbGHhlxAHDuK8GFZHxL1TN VCth2LABK5pecPpdOcaGHS//OryMrJqiK/dNoI2trEnU9y6DmDtVHvAZI9UH/vrew3/i O9Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=zu2krOKMhLU9kwLHj4/6+S+D2YPv0sKCo5RzcXMCJCQ=; b=R+YOysVTid8OziR2M47EizZBkcxDqg1Rjbrv+De5uQgoSa8iVALKB4Ukl8c9Qe1UoZ NtxaMtgplVE1Z4BSgTC1gcwusBvlEIU1x5YtyTAr12Sgyc2o/3kdCjnsKzJXMeMUcO+z seCRh6IDlwZ7XdH1SH2wxaBhHBRbTZoUO3YInwAIJdEEYbgyVMjHCguBEcfhWXmrALUL G5X/UPuKm+0O70FqsfHO+7huJFYlfyU4vIsGcUBjyUPYURkGRSNzJHALVOm/Ie6lTuqY LCShQho8wmhZCuGb5eB2mQJhuGa/pbYmMoe23Q8y15q6kiZHHXnjc8suQvgjRMC67XQT zBJQ== 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 n3-v6si23986983pld.116.2018.05.25.14.34.50; Fri, 25 May 2018 14:35:05 -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 S1030468AbeEYVeQ (ORCPT + 99 others); Fri, 25 May 2018 17:34:16 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:59679 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030403AbeEYVeM (ORCPT ); Fri, 25 May 2018 17:34:12 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MAXB0-1fTWP83nMg-00BeoK; Fri, 25 May 2018 23:33:41 +0200 From: Arnd Bergmann To: Alexei Starovoitov , Daniel Borkmann Cc: Arnd Bergmann , Yonghong Song , "David S. Miller" , Song Liu , Martin KaFai Lau , Chenbo Feng , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH, net-next 2/2] bpf: avoid -Wmaybe-uninitialized warning Date: Fri, 25 May 2018 23:33:20 +0200 Message-Id: <20180525213331.2115471-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180525213331.2115471-1-arnd@arndb.de> References: <20180525213331.2115471-1-arnd@arndb.de> X-Provags-ID: V03:K1:nvXbhged/p74c8JC1ib2clyM8v/J6YsPl6k6IyrPD+Duvhz8WOR 6awQqZmeaSODxy6tlL43jRTO5Eh9y0afNgjY8EbgOsvqXBHqYyzmTo5kVaO1hiohzH+e8x5 XwlSIejxV9KmxILz2UGGPPb+YWVO8PlEWVwV2olVLCbNpMJQUBG+VS6nSgIAjQ3obiKMnxl cld+nxmlIiQgWq45LIzIw== X-UI-Out-Filterresults: notjunk:1;V01:K0:EDWTd9JPXcI=:BI+G/XXennjVWjg8kX6A77 IjCNbXqDayborfR+tU/59uEVtZDaGtEQY5n/NNk6vyKrlk5sCQyAOl7RW0OXZ2ubmkq7LfOEn /4fBLZ6yf+KL7r3tvDWdkyay03NKgBcoB1GzENxiWSxG5xo9CoFfwJgS0RLedzXXCqnjuk+m4 gMnibZerCaf1s6HkFFo+VtxC7WuC3M/8Nx2girMpNZhI7CWEyeZC6DkiOl5XyiW9SSOvIookA kX1IMClHVLULCgu5vzVNwyjKfSf094SNAgM3gsPy/bjHrk+rWTQBeXiPmW2eCHoy4kJZzRjxy z9cgnN4KC/cZ7jjZEh2WCc37g0awsonFVV5nt8rD1/wjMQ4GXKzDpYssvwb64q0YDlc2d8UJB nNIRYKNwGQWPmLUgy8pTZvKDCe/q9Z/pfyDMAMBLqyyQIjBjvUD6+9iFcfTkBdQCfF2GyHiVo 9kNl5hV+kDV+8SHHtnTw+Pr/CXsNxe0cZNQTdw0HDdP7GX0jWtjT073fjcIgX/2zVuXZY8yJW fTgYzez2DbjEKRe06iVX3jH0QNvoV5vEZItlksIImvhpQmdUuU578wtaIxj6fz2qWgQXYgyNk KZgtTKuyzS7bUrWC2v5epf+pH3aGKr39NsHD7TeWw+ec3TtxLbvl461tg+XGEkYmdNLdGt7NP 3p61rtyp1psOX5BYYOWFscFzn/pMNx0Wqk1apwDGzSGbF4bVLI5nYr+c8A4aXHdoYcY8= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The stack_map_get_build_id_offset() function is too long for gcc to track whether 'work' may or may not be initialized at the end of it, leading to a false-positive warning: kernel/bpf/stackmap.c: In function 'stack_map_get_build_id_offset': kernel/bpf/stackmap.c:334:13: error: 'work' may be used uninitialized in this function [-Werror=maybe-uninitialized] This removes the 'in_nmi_ctx' flag and uses the state of that variable itself to see if it got initialized. Fixes: bae77c5eb5b2 ("bpf: enable stackmap with build_id in nmi context") Signed-off-by: Arnd Bergmann --- kernel/bpf/stackmap.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c index b59ace0f0f09..b675a3f3d141 100644 --- a/kernel/bpf/stackmap.c +++ b/kernel/bpf/stackmap.c @@ -285,11 +285,10 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, { int i; struct vm_area_struct *vma; - bool in_nmi_ctx = in_nmi(); bool irq_work_busy = false; - struct stack_map_irq_work *work; + struct stack_map_irq_work *work = NULL; - if (in_nmi_ctx) { + if (in_nmi()) { work = this_cpu_ptr(&up_read_work); if (work->irq_work.flags & IRQ_WORK_BUSY) /* cannot queue more up_read, fallback */ @@ -328,7 +327,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, id_offs[i].status = BPF_STACK_BUILD_ID_VALID; } - if (!in_nmi_ctx) { + if (!work) { up_read(¤t->mm->mmap_sem); } else { work->sem = ¤t->mm->mmap_sem; -- 2.9.0