From patchwork Fri May 25 21:33:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 136996 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp87568lji; Fri, 25 May 2018 14:34:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZov3tW4lEy+xDCYslruWFeDrBlw5DV1Lgs4STzg+oGJDZwvQAcGq3xb9jyv8q5bbBLXu4MS X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr4147718plt.288.1527284044388; Fri, 25 May 2018 14:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527284044; cv=none; d=google.com; s=arc-20160816; b=EAA2JYcn2a0q4IlHkoZ9pmnsrTF9YBOYgY80CdRvmqDcXgUblRbeGpCrD7YxvyZxU2 C9YzFFpCV5teJw5VIERIxlxXBIORYIfk4OsH/HypFTDYYf7htC0Tgoari1cyz+dTkRuJ 2nsa9BY9kkc2uOgUSDZ0CfZ2ZFfQPk4Hs4FqOghAfgP9V4P2GAPT2QeDC/Nc3flx9+Rz F/jSJ4rq3IXtwF52ZQBDchHaQiinkzovtmcgd33vmmcesk6ze7accpfF77Xwp/JVNTe+ zT1aae7lmHJPGi56n44UDz1C3IDxktGVdqX5rardJ+yoRGYL5WFlWx5lqX0L/lGJsJb4 n5Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kYbqIsi+LiqIKrY8WEE8HK04Mc5n+yyGTZEdMaAWQRg=; b=kc8wFlaqMqKpaaTNGnSn88POFM2vjYEID/p6bLI7cfmKc48Ia0PeCi/Pw6tgVWCY59 Qb2D1qkWjv+nYwY6ILYmx1yENoJEtCxwCUpLAYdXQWKe+tvaWlMmibXtnAQHOpiCdlNS QNusIgPLgUND7IiTPX86ucFZHlp0/LWMiNNRzS0j282XZ0ZE84tgKevyO97idFh6xRTr TiuKnBeWFehXeBW9pMseh9itrXW9w6/CyaoZLGMTH+DUk99g3LaTYRQiVCrf8tdpGaK9 sdDTe9InVSLR40VkmzI2S7HJIdaVOQC1IcJR3aipa1LvO2sXK1aGvs8eKQxGMvBD0/DX /Z9A== 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 a5-v6si24889002pll.123.2018.05.25.14.34.04; Fri, 25 May 2018 14:34:04 -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 S1030436AbeEYVeC (ORCPT + 30 others); Fri, 25 May 2018 17:34:02 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:54717 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030216AbeEYVeA (ORCPT ); Fri, 25 May 2018 17:34:00 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MNATs-1fOYKc2gUy-006gzC; Fri, 25 May 2018 23:33:34 +0200 From: Arnd Bergmann To: Alexei Starovoitov , Daniel Borkmann Cc: Arnd Bergmann , Martin KaFai Lau , Song Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH, net-next 1/2] bpf: btf: avoid -Wreturn-type warning Date: Fri, 25 May 2018 23:33:19 +0200 Message-Id: <20180525213331.2115471-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:yVV90sA6Eh8UbQLosTBJ/01CrbxUbLoorXerFl+UAztokMLIqJv cxSDnSRPlFWZzReHm2e6was45IZFgep7Katd7/9mrV1ihQgKjcjBuJCIy5arpguvUjPBzr5 /d/uVTbed4+wC3/HmkTGf/rQuV/HpvJSPXn90z8C8HH4l0jWNEXIpVYJjKK6wmq4FnbqM+M nK0AFYypmdjCMneg/dp8Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:mxSvhcuP3FM=:A7fuER43f4DbT1A1l2CCRd 0JeCOzhe5XybE1vvAItY2x3v+cUO4/0MkS34+OMG2u+9EDwpWILiNKIcJ0oB5rSz7O1yflJIb ob+bwfx+CW9QpN+Wme+TWs6K9tx8dDNpGnR1i0SPfjZbsG857hof9ZC8sLNE9/iC+H9ownaTY yRvfDY9694ErLHgn3NBJrYc4DQ0dBndNxnnoT2/QH5mCtv2xskufnRekQkUkzhjqsZmkGIopl aerZPVqU/6DbAWOUQnIJnvsmIxsEauN+UZjwNbULslwCXhmsvgAI7oC4pN2eHzI7CNykxVrKd YWbekrjz2GV5m7sdm9O+ZPirvEZyw99qvexbYxCo5Pbu0vf7STmmF4YLJa7QMLFzDBb7xkYpf 80HFWXeZQR7Fwjqphetm9rxDdtnkill+eFWl9shq/2+DSVajeYOl+NsNX2t/LWaRzvPgc4xBX FXATYxuCo8vlKhr6i/IRCQBNSSjCTaIyM2ddV3aef2abYk1hIMSguGkUELUze+aB6uyByoDF+ vVVEZxxSx900pGNvy8o0ocWNcIjEYLEQ93s4+dbm384rP9DSCJC/11OG2jmLtVzF2EnZSZKs1 PkZbACrSRjF85MFDzg/JEdLrAlbjzVYNPTqBDRN+H9DutSi9akT6BthKrPq5YOROpufOBDCAP wepCby6aYm9/7yxtt8OvTKj/JC2z6Jl4N6ZfWXNL+LFIF5ikhF2CERUevkubakfjunrg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc warns about a noreturn function possibly returning in some configurations: kernel/bpf/btf.c: In function 'env_type_is_resolve_sink': kernel/bpf/btf.c:729:1: error: control reaches end of non-void function [-Werror=return-type] Using BUG() instead of BUG_ON() avoids that warning and otherwise does the exact same thing. Fixes: eb3f595dab40 ("bpf: btf: Validate type reference") Signed-off-by: Arnd Bergmann --- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 Acked-by: Song Liu diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 9cbeabb5aca3..2822a0cf4f48 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -749,7 +749,7 @@ static bool env_type_is_resolve_sink(const struct btf_verifier_env *env, !btf_type_is_array(next_type) && !btf_type_is_struct(next_type); default: - BUG_ON(1); + BUG(); } } From patchwork Fri May 25 21:33:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 136997 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp87749lji; Fri, 25 May 2018 14:34:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpYgaqao1BvcULLYqoWlUyK3YJm0UnNPq6B1h9wzWBDJAllhheh39Uq1zuPTt8ZjNVoNXKC X-Received: by 2002:a17:902:5ac1:: with SMTP id g1-v6mr4205165plm.43.1527284059995; Fri, 25 May 2018 14:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527284059; cv=none; d=google.com; s=arc-20160816; b=bntKVDjQ35T+sMlALZIahZvVI47+NsBsWT7+T+TNcMw+wNOe+x1IT+7ol4M2mYUhgP IL+p7PwDeXePBzAIwzchLENKlOhudjxoD372vLUFG1j7jUPQqsPfmRUjfEGLOEY1ljA0 mBclzy19/GDcPxmLDL0cOSbnnYSBdhR8nBQpEDddxWMG7T9f/8/6PbtKRjIX3kiC73tj bqFDfoNg0lDmARfu/f4KIWpp58fEvfw9U9cappAT5I3nV+AQSJknII5MhY/sNgnGLZFN ttEMcP0s/Mbhh5scv9d5D0JWV0SiSVARX8RflOXJNYmA86oVg16wsy4fJZ+77qMtnaz3 YuQA== 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 z128-v6si19547540pgb.28.2018.05.25.14.34.19; Fri, 25 May 2018 14:34:19 -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 S1030476AbeEYVeQ (ORCPT + 30 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(-) -- 2.9.0 Acked-by: Song Liu 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;