Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2948808pxb; Tue, 13 Apr 2021 14:29:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywWk4SwsmM3oWtzZoyFWDcNch4VfjegDNafySCnUXETl3orwUAp8fwiX1N0yt3A9kyNMmj X-Received: by 2002:a17:906:8144:: with SMTP id z4mr18041161ejw.404.1618349381693; Tue, 13 Apr 2021 14:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618349381; cv=none; d=google.com; s=arc-20160816; b=gSqnI9f8yEA+wCeJHrnthQPWYVw4HvbILWuiYVHlbYQbcoWBm0Gvxi11MflEo0iZae qJBK/oS95gdwml8snvcppEolrqCvRT4lCoQVtBN8Ou0gR13VhKmTv30pW34V4/S8/VX3 5YiW0iQDQHfBji4jGpzGUD0OlrqdbLR/qEnqv5mzm+jQ1lOPt1huMONZmWHD4+fw06/c xEG2eR7ejo8yO+uG0DhzndHDYYv0J9/bYmv/7wLoMy0MDK4buSZbo3+LV1sxZfeeIzl4 CczIRhZy7AUoD0t7CTLAIAEe5Ahbyt94eQcaJLDJnLF68vt8IKKyevJXf0sqdQUB9OK8 wSFA== 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=oZa6xX98+lkUJw38jz4IW+RW3vhcytEYCGbyuVjeplQ=; b=rtFF5ZeaorYYInzxYZfD/+d7KMOy1C0fO2HujCxj2uKO/nLRR1d26IQZZBXdwmyA9I WMHA3UKbBWeuVQvrTRZMevreVZtbkj814/Rj4btJzoJOM5OOOGO1h1mi7hYnrsWs3ICi /FA3ytsYV2zSHna0GflLMtWZ5y5rkzcA9dBLlEuZF3FvSj4s/i8fjeu8ePjjbMbHIUkn RO3Kv5R5kn/YP/aKj8czgIsE4Wp5o2ZED2F4cFNfkPyxM21/lO/Y5C4UKBAUlVcq5jaX o6k1HiNKzwgfQ/uJYC5ucRzG6G9i0yuIox0aG4hHentQJzJAZ9QsiswFtosTD4wjYyvn 62XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="k8t/UGWh"; 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 b1si11786573ejb.714.2021.04.13.14.29.18; Tue, 13 Apr 2021 14:29:41 -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="k8t/UGWh"; 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 S237964AbhDMQO5 (ORCPT + 99 others); Tue, 13 Apr 2021 12:14:57 -0400 Received: from mail-lf1-f54.google.com ([209.85.167.54]:44839 "EHLO mail-lf1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236853AbhDMQO5 (ORCPT ); Tue, 13 Apr 2021 12:14:57 -0400 Received: by mail-lf1-f54.google.com with SMTP id e14so15482403lfn.11; Tue, 13 Apr 2021 09:14:36 -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=oZa6xX98+lkUJw38jz4IW+RW3vhcytEYCGbyuVjeplQ=; b=k8t/UGWhPiHZJ45SazvSK/dkLlXNJ5vqj7mHLukq3zLiERcxc/6G9btqsJBVr8Y+sL JLsA6lL5O0zB0Vs37DDDFoNZFwER+7OOoJ/9zjGPPON73d9+m+bYIcUeZtP1h/p4qxzo ykulc3XEMWfj3dvHmdKfS1J8TVbpFIzSm81pCW8ps8TQ13zlddfINi08AV+d9yTZaX8n ekhADWpivzyZj9rbR0q0kdRY12dAyB9K74PTHwCipEmiCjViFCGX+r12NzhrS34RsQWR WfyAKQlIAw0EKE67zHn6HV+TlH6T45Y7wvuhedvwc7hqiT5SXot3OOjuFBixWGhypA3A 3S8Q== 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=oZa6xX98+lkUJw38jz4IW+RW3vhcytEYCGbyuVjeplQ=; b=L3kagSCQo8DdUBssMUxD0FkJ8Ayck5nVrR6yVL1nwj2l18tOL3o/d5gAUNEfdFCtgb ZV6WJs2CwdrFAdbtT34gMRUl6SepowgPxvG9lND1aQZc/+ZODQXpbWJPcSh7o79+V8Lw ba9auejzP33yk+7qyKwRtNBEJBg7rqV27dd7l6uOWCtvacoys1g7j8NwqlQa02X0Ig7B 3KSUhdlrnxSAS31b7y1xfr9Hi3uNK/2gM6v2NB8CECEtXa+1Tfxvw9JPt9piYAgebMnH TohXKZ+LVN0MOxXieBeVCkttd80zD9v68cpFdeLNuPdgN+gP61DWYhSkUklNHlgyfrR/ t6KQ== X-Gm-Message-State: AOAM533JMsVBVoz2jjUoBupwoy1pwz3xn34TLEHhq097LDqnrwH5L//K sp1OK1xRQFbF6vHH9dfaoZm5yJPeCWasoGjZU/c= X-Received: by 2002:ac2:4d4d:: with SMTP id 13mr16413881lfp.540.1618330415836; Tue, 13 Apr 2021 09:13:35 -0700 (PDT) MIME-Version: 1.0 References: <1618307549-78149-1-git-send-email-yang.lee@linux.alibaba.com> In-Reply-To: From: Alexei Starovoitov Date: Tue, 13 Apr 2021 09:13:24 -0700 Message-ID: Subject: Re: [PATCH] selftests/bpf: use !E instead of comparing with NULL To: "Bird, Tim" Cc: Yang Li , 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 9:10 AM wrote: > > > > > -----Original Message----- > > From: Alexei Starovoitov > > > > 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. > Why? > > > They might not adhere to kernel coding style in some cases. > > The code could be grossly inefficient and even buggy. > There would have to be a really good reason to accept > grossly inefficient and even buggy code into the kernel. > > Can you please explain what that reason is? It's not the kernel. It's a test of bpf program.