Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp229958iob; Mon, 2 May 2022 17:54:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyanqdYhOnAD4PyR6cbWI6EddDaIfStNRBQzBjFC9gVKFgp0X6puv2Y/Tdrzs7FVoF1+H5I X-Received: by 2002:a63:7702:0:b0:3ab:4d62:b68b with SMTP id s2-20020a637702000000b003ab4d62b68bmr12245292pgc.452.1651539275209; Mon, 02 May 2022 17:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651539275; cv=none; d=google.com; s=arc-20160816; b=ZI3caLkTNs7dtTR5c9OMr8FVZU4gIe1AuT+3GM56FzNVqd3sNor5OVEFgzLhby2a6s /2J3d3FzvIi/j7om1mdvq9Hu0foagH7UzaLgFKN9w5wLvJfdDtc5uSvseGSXcxMd3WW+ ZD6IUgQbWtzmTzmJnXB6YaJWWHkE2AXeXkbBpXqmhfCLp0ZsT8JsA2dCbN7RYU4dqogy QxqhQmv/l19o9QJGF8H5p4vZY/4Lui2kcf3k6r/7GOAWerk2HS+A6KwsHEQFBbKH+H85 pzFsz0wG0WAXlg6eZf0sa11oLwbIwTvp8fY3ZuTSLcPJ1GcLAlFBH51AT64RTBuWSRjg BFnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BFhJTeBHegUGtkoKbPnigoTiPCA3aoao0K+t84QabKg=; b=LDPM9MeRVh4R8OlLoRUAUhlkDVIA9ovgo+T56EWfAPeSv68KMtg0yGIhnuj9VPuBFU uPEicoG6naZNsXxHqQeEMaj1+KouG4e66f0vhj5iez66/fgO3/X+fmk3IwWy7YcYrFWm up44C8qQK13+Uc10Ts/HIFggMJf6WcGBOSrPI6ntfK+EpOnjZHJnpcGHnFTd74JEIOUw nYAAY6FtYGqI+SnDCoS5I2YSol5/R9p3I9tCVamaojBa4Fd2QX0eikvuGvQIcP+3+KxT OqXkkjt89SiNhvOvSvFqeotq2ido86X/vbZtNFecvuiZCY9Z59mQ38y47V1Rw3EFZMpS 46LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jfXKPvMz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 19-20020a631753000000b003aa8b6e4691si15180386pgx.761.2022.05.02.17.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:54:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jfXKPvMz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 766EA4739A; Mon, 2 May 2022 17:41:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349957AbiD1Q0Y (ORCPT + 99 others); Thu, 28 Apr 2022 12:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349952AbiD1Q0U (ORCPT ); Thu, 28 Apr 2022 12:26:20 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 586016A43F; Thu, 28 Apr 2022 09:23:05 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id b5so2314192ile.0; Thu, 28 Apr 2022 09:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BFhJTeBHegUGtkoKbPnigoTiPCA3aoao0K+t84QabKg=; b=jfXKPvMzYUegjls0RnwX8rppG+Ce5wuHyePNtzxGVl+zXyb2acEES4JRq5s3Robr3W AY623UmGkEqjuPDd0mngHOQHxpCkAkAFd2aFU3589FRzNtpTicD6Hv6oeXRpa0weT3yg TlW5cMZ1ALl7VZHhvqWjvwEJLI4dqRtMZAOZWy/vy6R9w6RJ+3ALAjvmqjE1MkjK4gUk yY0SGHz5Cwn4Dr0swRqp7cwUAfDck1LUFA/KKe0tRD3A+hu09E4eU7Gx6wJ16K7DZsvY U0Kk3W6c7jGJuy4BdJsXNsiDgIt/Bbi7yvVLjPBwkQ8Z1ac6Uxb2DWlDCIc+tFJNlLhC s63A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BFhJTeBHegUGtkoKbPnigoTiPCA3aoao0K+t84QabKg=; b=Ctnm7JrB7ke6zXmNe6tMZPfChH17ByObLUj4rVaUuS2npUYx+hANZqdSh9mUJjm/0U 0AQ9Z3hskl8+U1rKz58dpbwakXGuZVf58Lj4NIaNAZNNH0iqMcNNWw7SCEa8YhqxcyLS 6t/EIyqvWoo/78T1ZyJmbAnGGlt3Y4OWTfUF89GpKQ92aOWHIstT+2uRmcbl1Alp9oqE NBJ1CrwHWE1E6k8sIlloalUsgy/mGHzqw9LMBT1ditDrOjl2J+9WJCNpYR8DZ0slkqRJ R33/IVtAH1OSJ+j2HVsaddS1nvKNDI0YaOAz0EZjRSe6CYqXYNo220yuCzrpHYgT4R2z PQng== X-Gm-Message-State: AOAM530k7YGTLavmnuu1SPGXCDl33x1kslw/u9r2jCZC2JKTRiBmfXUf 9jIb4RGFmQjuhkZfhet6WPewyBoIoOpDBS+4Ha0= X-Received: by 2002:a92:c247:0:b0:2cc:1798:74fe with SMTP id k7-20020a92c247000000b002cc179874femr13498199ilo.239.1651162984685; Thu, 28 Apr 2022 09:23:04 -0700 (PDT) MIME-Version: 1.0 References: <202204271656.OTIj2QNJ-lkp@intel.com> In-Reply-To: From: Andrii Nakryiko Date: Thu, 28 Apr 2022 09:22:53 -0700 Message-ID: Subject: Re: [PATCH] libbpf: fix returnvar.cocci warnings To: Alexei Starovoitov Cc: kernel test robot , Julia Lawall , Andrii Nakryiko , kbuild-all@lists.01.org, Linux Memory Management List , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Network Development , bpf , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 27, 2022 at 9:07 AM Alexei Starovoitov wrote: > > On Wed, Apr 27, 2022 at 1:04 AM kernel test robot wrote: > > > > From: kernel test robot > > > > tools/lib/bpf/relo_core.c:1064:8-11: Unneeded variable: "len". Return "0" on line 1086 > > > > > > Remove unneeded variable used to store return value. > > > > Generated by: scripts/coccinelle/misc/returnvar.cocci > > > > Fixes: b58af63aab11 ("libbpf: Refactor CO-RE relo human description formatting routine") > > CC: Andrii Nakryiko > > Reported-by: kernel test robot > > Signed-off-by: kernel test robot > > --- > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > head: f02ac5c95dfd45d2f50ecc68d79177de326c668c > > commit: b58af63aab11e4ae00fe96de9505759cfdde8ee9 [6746/7265] libbpf: Refactor CO-RE relo human description formatting routine > > :::::: branch date: 2 hours ago > > :::::: commit date: 9 hours ago > > > > tools/lib/bpf/relo_core.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > --- a/tools/lib/bpf/relo_core.c > > +++ b/tools/lib/bpf/relo_core.c > > @@ -1061,7 +1061,7 @@ static int bpf_core_format_spec(char *bu > > const struct btf_enum *e; > > const char *s; > > __u32 type_id; > > - int i, len = 0; > > + int i; > > > > #define append_buf(fmt, args...) \ > > ({ \ > > @@ -1083,7 +1083,7 @@ static int bpf_core_format_spec(char *bu > > type_id, btf_kind_str(t), str_is_empty(s) ? "" : s); > > > > if (core_relo_is_type_based(spec->relo_kind)) > > - return len; > > + return 0; > > cocci is wrong. > It missed append_buf() macro. Should be irrelevant once [0] lands. It makes use of that return value directly. [0] https://patchwork.kernel.org/project/netdevbpf/patch/20220428041523.4089853-2-andrii@kernel.org/ > > Please fix cocci so we don't have to manually deal with > broken patches like this one.