Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp13309pxb; Wed, 30 Mar 2022 21:26:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDw8okj9RBAEFW4q7NPWpDUJjXqC1BskhOQJCDrf8Uv/eTOYx6bGcgHIdvaLU0diMAIMO0 X-Received: by 2002:a17:903:1247:b0:156:25b4:4206 with SMTP id u7-20020a170903124700b0015625b44206mr3506443plh.146.1648700788019; Wed, 30 Mar 2022 21:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648700788; cv=none; d=google.com; s=arc-20160816; b=KTKA/U3PqJR2yUeg46mFslPf+cpBawFwhPiakiTpNrYM7ySF6g30CKXzoeA23scsRz P6u3Ne+m2p9NCUOaimNDGf8EP+fq2c5ZWOvtOztbjlfjMF5LkSpdJzg2BNgt6DS8x27m 6rsExbFiyjs1m7rjv014aA8ipfWNzfh6+M3+q489MMaJKrbQGxgRDw1xKQB34cILCtVC k0Sj2M5wtjb1izesxeTAT3RU9Q2Ihdl+5+hfxQO930Ro/PECaQhndmPQf74pxlyF0RCI gjWk3qFF17EytbfHmKJZ/vZq6hcRkUF7g7r83cYejgnbSB1BXImA9POU3A8bxpgVWubt Tp5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=EO6leceYbvLY4rtQDMhjoWDsZXDmwJkZwjIi6YLTn5s=; b=Vbt3A3A5yqGBa+tcH6432FZeIIAL1aONHb8n8ukwfL60GIJ9ayyrNRf4dymVd1p2I1 QTDAHETbp8bxriRUqt4PY9R8mDBj3/QzhSxHORn1sI5FNQtGYpJNwRFKGkVQJRyg9Mjl 7E8v1jTvoMwvH/1cyib843uSmRY3jJGnvoZoY1CO7wgLz4dqQSv4phm35HCPhQgPUkrK WB01V4lNjlCoaFHZGHppUEvy3sf0pISnJvb4fYvFeVRu6N7lb67MADzmdykjwE3+XWdi xI4STRLi6Z9RIyS/BQnrDJa8r8ZPWzw92exDb9hFvnBhrnCIjZKPdcJisfAGT0IFTTcP cKIA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id mh9-20020a17090b4ac900b001c6d662f572si2537220pjb.55.2022.03.30.21.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 21:26:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4237F1C4B32; Wed, 30 Mar 2022 20:22:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241818AbiC3CBq (ORCPT + 99 others); Tue, 29 Mar 2022 22:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241785AbiC3CBo (ORCPT ); Tue, 29 Mar 2022 22:01:44 -0400 Received: from mail.meizu.com (edge05.meizu.com [157.122.146.251]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DC7D6D19B; Tue, 29 Mar 2022 18:59:58 -0700 (PDT) Received: from IT-EXMB-1-125.meizu.com (172.16.1.125) by mz-mail12.meizu.com (172.16.1.108) with Microsoft SMTP Server (TLS) id 14.3.487.0; Wed, 30 Mar 2022 09:59:58 +0800 Received: from meizu.meizu.com (172.16.137.70) by IT-EXMB-1-125.meizu.com (172.16.1.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Wed, 30 Mar 2022 09:59:56 +0800 From: Haowen Bai To: Shuah Khan , Alexei Starovoitov , "Daniel Borkmann" , Andrii Nakryiko , "Martin KaFai Lau" , Song Liu , Yonghong Song , John Fastabend , KP Singh CC: Haowen Bai , , , , Subject: [PATCH V2] selftests/bpf: Fix warning comparing pointer to 0 Date: Wed, 30 Mar 2022 09:59:48 +0800 Message-ID: <1648605588-19269-1-git-send-email-baihaowen@meizu.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <29503ac1-69ab-a0b7-53bc-5a7522baa289@linuxfoundation.org> References: <29503ac1-69ab-a0b7-53bc-5a7522baa289@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.16.137.70] X-ClientProxiedBy: IT-EXMB-1-125.meizu.com (172.16.1.125) To IT-EXMB-1-125.meizu.com (172.16.1.125) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 Avoid pointer type value compared with 0 to make code clear. reported by coccicheck: tools/testing/selftests/bpf/progs/map_ptr_kern.c:370:21-22: WARNING comparing pointer to 0 tools/testing/selftests/bpf/progs/map_ptr_kern.c:397:21-22: WARNING comparing pointer to 0 Signed-off-by: Haowen Bai --- V1->V2: include the error/warn message. tools/testing/selftests/bpf/progs/map_ptr_kern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/map_ptr_kern.c b/tools/testing/selftests/bpf/progs/map_ptr_kern.c index b64df94..db388f5 100644 --- a/tools/testing/selftests/bpf/progs/map_ptr_kern.c +++ b/tools/testing/selftests/bpf/progs/map_ptr_kern.c @@ -367,7 +367,7 @@ static inline int check_array_of_maps(void) VERIFY(check_default(&array_of_maps->map, map)); inner_map = bpf_map_lookup_elem(array_of_maps, &key); - VERIFY(inner_map != 0); + VERIFY(inner_map != NULL); VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES); return 1; @@ -394,7 +394,7 @@ static inline int check_hash_of_maps(void) VERIFY(check_default(&hash_of_maps->map, map)); inner_map = bpf_map_lookup_elem(hash_of_maps, &key); - VERIFY(inner_map != 0); + VERIFY(inner_map != NULL); VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES); return 1; -- 2.7.4