Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2931203pxb; Tue, 13 Apr 2021 14:01:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSNfAHnsy40fdvzmFNpdP6uWlaGI+Bf5Seb8BAjaANA21mERGD54Qy6oP0800cuQiIOMUO X-Received: by 2002:a05:6a00:162c:b029:22b:4491:d63a with SMTP id e12-20020a056a00162cb029022b4491d63amr32215769pfc.28.1618347683494; Tue, 13 Apr 2021 14:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618347683; cv=none; d=google.com; s=arc-20160816; b=Lx/nGXcrnTqiilepCj3d+oXLbEa6wKlX9gCtKHLDBkEH+pK9GIjuZmCX3a0fLjJGID JO+fJ4pkwJDGUlS98Wey1E3uIeL2P53Dv6sirzqj6FcLJivWdRNwy8j3xXuQpZ7751tQ PmWy7EXb3WQzb3aBoKfpbEStrxFwNE1/ECCtPcmtuWinIQdL2X+ciiHXgwU2Gq6d67qJ /CJpQZP6yEr7jKjYuWsPxCj1fsvRKLcZyWyq4ysReafwnSsky0Tdt8pzcXgcbkpUIVCB Ecz8mKlK7tbDkyFrexo+AgJ80K6rLfMMpPELkgLWDxXcBU16mwEu9rqtlL3Ggj+TYRbK gy2w== 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=ppycM44YZ5/x+F+FpvuSz3e42AYu8dnomgM7Aqbca+E=; b=MTZuVofk8e8a4RdSrju8+AzHmAEXp70EgzdUrAr+zgv2f8HLvVIZ05qOP44672xUOG OIZugQ0pZyFhv4T8si5BrT0D0Cl0mtsBCd7YhAnudyHoZGLe61T1JXVp7Z9D5SmTI4XH mlAegycNezhH8dP8m8oYdoeW43jTV9Bcmr7Sf4VGPfebmbp0Hdqe82TsJDP36K1srXaR Eo7uM63UKYtpm1D6VDp6INm4aEqsrGb4TEgZ+hoeyl4bGD6mEufuvHwI91g1hcq9LePI S3nuRMkyqGL0oOdm3+07zurdIXNIDOyTxBvtgp7xH3CV1Wb05IoBgrq1qjgshB8SpEPh //Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hV1cZt86; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ep3si3093705pjb.28.2021.04.13.14.01.10; Tue, 13 Apr 2021 14:01:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hV1cZt86; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345596AbhDMPR6 (ORCPT + 99 others); Tue, 13 Apr 2021 11:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbhDMPR5 (ORCPT ); Tue, 13 Apr 2021 11:17:57 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4FAC061574; Tue, 13 Apr 2021 08:17:37 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id u20so19744965lja.13; Tue, 13 Apr 2021 08:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ppycM44YZ5/x+F+FpvuSz3e42AYu8dnomgM7Aqbca+E=; b=hV1cZt86ol9OrFFJMnsOxExc4VN7PmveVwEcLa466q1WCtozm5QiWOrb197eE23XQK 2sUzjmdIWPmI/LTl23676LpJpXYHXXgbAR1Vk+XIsZux00hHeRWuDofGjTjxEaJSKi6x LW3obTPgpF3SWNHhg5vyCh46TC6fSZFfkfd91eTEXBQatTLJTa09Iiha0YKYRVuupIpx PrZ6nInhLZcdrQvDqv8M5rH9nIoGjVWv9Hhr+yC5yaZQhaamie142rbNiOtOQ0ItEB0i gJsYW4R57MeY6yjWx8EeGV4Vcuw9O3dfOQMCW065uwMla0ELZI33EgVb12m1bK3Lf0nq qxCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ppycM44YZ5/x+F+FpvuSz3e42AYu8dnomgM7Aqbca+E=; b=aRj+4Sm5mMOgg4750RG1Nbh04aQiYL0WfWgD9xVknQjgUbQYgloNj93kw6Fr1ZsRzb XzJ98brAmeNQFMVhI1XmZIviSLfTp8YdCMecKMHMUwS28z16NayrC/voVNZBlHoQfSdw 03NUU4o/2hxcM+cM1bCRb4DeLtgvntzMp06Np28NFNEOoT0UoLceqU7Lx4FuxBbOXCmv jWl97V90Y7EelHwWC3mdD+WjKH36jPQeVefSTpm7CBxtz3yglw/q7el4nK4ckKlcc4Eh sZviBCwEJPR1nMrLsaUifOVvRqapSU0F9eqMmAP2yRS/gZDUtjd6QZV/d/TmCxJw6T9C gkbw== X-Gm-Message-State: AOAM531U4bMBy0pSHofBaT1eqbIjaUC3BVrHlKMKxGiAo2PjVHwpmRvN q4QabFNlFoHTsno288iLcgD97hc/JoAYKMPMX98= X-Received: by 2002:a2e:894d:: with SMTP id b13mr13096620ljk.486.1618327040638; Tue, 13 Apr 2021 08:17:20 -0700 (PDT) MIME-Version: 1.0 References: <1618307549-78149-1-git-send-email-yang.lee@linux.alibaba.com> In-Reply-To: <1618307549-78149-1-git-send-email-yang.lee@linux.alibaba.com> From: Alexei Starovoitov Date: Tue, 13 Apr 2021 08:17:09 -0700 Message-ID: Subject: Re: [PATCH] selftests/bpf: use !E instead of comparing with NULL To: Yang Li Cc: Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "open list:KERNEL SELFTEST FRAMEWORK" , Network Development , bpf , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 2:52 AM Yang Li wrote: > > Fix the following coccicheck warnings: > ./tools/testing/selftests/bpf/progs/profiler.inc.h:189:7-11: WARNING > comparing pointer to 0, suggest !E > ./tools/testing/selftests/bpf/progs/profiler.inc.h:361:7-11: WARNING > comparing pointer to 0, suggest !E > ./tools/testing/selftests/bpf/progs/profiler.inc.h:386:14-18: WARNING > comparing pointer to 0, suggest !E > ./tools/testing/selftests/bpf/progs/profiler.inc.h:402:14-18: WARNING > comparing pointer to 0, suggest !E > ./tools/testing/selftests/bpf/progs/profiler.inc.h:433:7-11: WARNING > comparing pointer to 0, suggest !E > ./tools/testing/selftests/bpf/progs/profiler.inc.h:534:14-18: WARNING > comparing pointer to 0, suggest !E > ./tools/testing/selftests/bpf/progs/profiler.inc.h:625:7-11: WARNING > comparing pointer to 0, suggest !E > ./tools/testing/selftests/bpf/progs/profiler.inc.h:767:7-11: WARNING > comparing pointer to 0, suggest !E > > Reported-by: Abaci Robot > Signed-off-by: Yang Li > --- > tools/testing/selftests/bpf/progs/profiler.inc.h | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h > index 4896fdf8..a33066c 100644 > --- a/tools/testing/selftests/bpf/progs/profiler.inc.h > +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h > @@ -189,7 +189,7 @@ static INLINE void populate_ancestors(struct task_struct* task, > #endif > for (num_ancestors = 0; num_ancestors < MAX_ANCESTORS; num_ancestors++) { > parent = BPF_CORE_READ(parent, real_parent); > - if (parent == NULL) > + if (!parent) Sorry, but I'd like the progs to stay as close as possible to the way they were written. They might not adhere to kernel coding style in some cases. The code could be grossly inefficient and even buggy. Please don't run spell checks, coccicheck, checkpatch.pl on them.