Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3437824ybb; Mon, 23 Mar 2020 00:43:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvZKXqs/fQZ6c1LrjfUTaRBIULnytqSHt78xeEwamm0mPbmkpbHtwztxfsLzvbxyXVyb4U0 X-Received: by 2002:a05:6830:1da4:: with SMTP id z4mr669222oti.5.1584949403350; Mon, 23 Mar 2020 00:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584949403; cv=none; d=google.com; s=arc-20160816; b=HlZ4GxK7HiEszsubnC28TLcSfAq/mTvwOvkQ8PcUote0nteGJ2mRfLT1+3WMVjUR9K gMBvdVflqLYsXyTbZP3hYApQ/vOOenIvM2K+bta/AmbEycm8e9YWA6E+C2ZmzBksLB5k xlVpXCbVcG2uLjDHO08J7nRmSkDxiyxkbQiPFgKqdeUP9pcLvxFvV2tJdJRMP/O60JZ+ dFERSTjb9Wt8TUMFKr5lJXSCrCDfkpXE1d/UE7p6rgUISsDeKjzwrBsS3yw0UOmdygGX rui4FtFM9S2UKuhSQjMDrQHTEXduEpUDhoVJ0osuNlpD/IG8U4x2xjfIBwQZwDyk+gSA uGrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=UZh37ycoXEQPJvIa8TQQD4wS32qVanpxbiaipTPYPv4=; b=eRBJaT15ebiHRAAt4SDDTtSuiW+6iqNeuGA7adj/WoSyrefiD0dL2rr4FDzda/8aKE P1b1YNsa07kABjvt9kjK/RIKq4XRoq/seBXuhRSkLkACjCmHIPTwcP3M+MKMblly3nuA 5Dv9q9Haqxtm3s6V1g/oCcQCDPVm/Ls6RkLov56Mc++P+O03gi0CaFHLlfA7n/0txNiM hn1jXn+Qh4r2kAu683lpuq+3X7nywH3fEImDgBJd0g2Z8vTiMHE90+Ae2xyx02cG7XHS 2kOrXrLd4qvrzBlK0J+SByKG3hjErPqhlLR/EqhW8966M5mQ8rXntEpsWkLmA7lsDtC4 11eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VVQvLgWT; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y25si8897052otj.304.2020.03.23.00.43.09; Mon, 23 Mar 2020 00:43:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VVQvLgWT; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727463AbgCWHmv (ORCPT + 99 others); Mon, 23 Mar 2020 03:42:51 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38619 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727430AbgCWHmv (ORCPT ); Mon, 23 Mar 2020 03:42:51 -0400 Received: by mail-wr1-f65.google.com with SMTP id s1so15619593wrv.5; Mon, 23 Mar 2020 00:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UZh37ycoXEQPJvIa8TQQD4wS32qVanpxbiaipTPYPv4=; b=VVQvLgWT8eeBqcR18iurqJfr5XafnB3FvZhL24uObshAdADJo6ReTy467QzsXVgXJi uyg/c7WimX6uOBVdq3J79hkpu4KM84XT1MLjiUhTCggHFO5cjZZX7WVjXAaGq/IOcRgH lQL6tH4h6mItv8MJ5O/5cOeBjbNaZ+xAPQ81qpIG0p7GPBXbQJ9PuIK3X2KFykT96N4c 9wblwjAzlTysTBvlUo7yrkpOK+ofL9/sCglExcYwgdoFQr1rtX0O7DOsK9VHyYygN9dV lRVKnItn8J3EIEvGoA85GpVVeXxLZct4suN75z8zbXbZFOj/0xlH8QJJj8AKrihMZocA EM2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UZh37ycoXEQPJvIa8TQQD4wS32qVanpxbiaipTPYPv4=; b=HwOHjaNrLUQRt6B6m4gQyiUa29F4+Fg32+Zybx/LZ4i5Bk7obxyogo0/GBP1qNsXcf 465Rj+02CnGkwJOLngvQrPd9YnFR0HDZAZ+62bmr7N1xav4pZWGUDGKixMf/ryvYPAgu BlOvKoVKMz5SxBgyG20dTKlHVG9k9JBBaQEoLQVOdBK899HhuzF2XRlGbh2ps0Xy/qnu f9vpJFxNggQAg2hXwJWxccxQKgEVhrz3Oqqu6NKXc12jmeza2guoxNyE3UyfzjMQ0CYI 6UsxsMnk2niYzVPs+Q50M0oWMkSy53OVtvIwnPlck4BaRIOmp0wk6Xr9QRsnoUVyJAvK zhzQ== X-Gm-Message-State: ANhLgQ1YsZQKhnwXvuToIWXbQlaTMOj+5SiE9vpsqs2v1KY0F+LNuLNS FwOYXE9SDxHzB4YcnzyQOjg= X-Received: by 2002:a5d:63d2:: with SMTP id c18mr6797923wrw.385.1584949368405; Mon, 23 Mar 2020 00:42:48 -0700 (PDT) Received: from localhost ([2a02:21b0:9002:6131:e6f7:db0e:d6e9:e56e]) by smtp.gmail.com with ESMTPSA id b7sm1569052wrn.67.2020.03.23.00.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 00:42:47 -0700 (PDT) Date: Mon, 23 Mar 2020 08:42:47 +0100 From: Jean-Philippe Menil To: Yonghong Song Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Andrii Nakryiko , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bpf: fix build warning - missing prototype Message-ID: <20200323074247.wdkfualyvf3n6vlo@macbook> References: <20200322140844.4674-1-jpmenil@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/03/20 at 10:32pm, Yonghong Song wrote: > > >On 3/22/20 7:08 AM, Jean-Philippe Menil wrote: >>Fix build warning when building net/bpf/test_run.o with W=1 due >>to missing prototype for bpf_fentry_test{1..6}. >> >>These functions are only used in test_run.c so just make them static. >>Therefore inline keyword should sit between storage class and type. > >This won't work. These functions are intentionally global functions >so that their definitions will be in vmlinux BTF and fentry/fexit kernel >selftests can run against them. > >See file >linux/tools/testing/selftests/bpf/progs/{fentry_test.c,fexit_test.c}. > I can see now, thanks for the pointer. I totally missed that. So, in order to fix the warnings, better to declare the prototypes? (compiling with W=1 may be a bit unusual). >> >>Signed-off-by: Jean-Philippe Menil >>--- >> net/bpf/test_run.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >>diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c >>index d555c0d8657d..c0dcd29f682c 100644 >>--- a/net/bpf/test_run.c >>+++ b/net/bpf/test_run.c >>@@ -113,32 +113,32 @@ static int bpf_test_finish(const union bpf_attr *kattr, >> * architecture dependent calling conventions. 7+ can be supported in the >> * future. >> */ >>-int noinline bpf_fentry_test1(int a) >>+static noinline int bpf_fentry_test1(int a) >> { >> return a + 1; >> } >>-int noinline bpf_fentry_test2(int a, u64 b) >>+static noinline int bpf_fentry_test2(int a, u64 b) >> { >> return a + b; >> } >>-int noinline bpf_fentry_test3(char a, int b, u64 c) >>+static noinline int bpf_fentry_test3(char a, int b, u64 c) >> { >> return a + b + c; >> } >>-int noinline bpf_fentry_test4(void *a, char b, int c, u64 d) >>+static noinline int bpf_fentry_test4(void *a, char b, int c, u64 d) >> { >> return (long)a + b + c + d; >> } >>-int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e) >>+static noinline int bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e) >> { >> return a + (long)b + c + d + e; >> } >>-int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f) >>+static noinline int bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f) >> { >> return a + (long)b + c + d + (long)e + f; >> } >> -- Jean-Philippe Menil