Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2238000pxb; Fri, 25 Mar 2022 13:39:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmFAAKyz790i3P7BAaatMCCdqJb2B8NrfLwJontqGW1db3yV5V1wfklgRs2DMXLX66ZVF8 X-Received: by 2002:a17:90a:d154:b0:1c6:64a5:a413 with SMTP id t20-20020a17090ad15400b001c664a5a413mr27134620pjw.6.1648240765709; Fri, 25 Mar 2022 13:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648240765; cv=none; d=google.com; s=arc-20160816; b=muFFrGUUpZfgVsTZBExH/Nqm/lFp5e6iLMyUaxZ+nYtQq7wDBUC4S+6e/j5YR7l4Pr Ff2KhWTsA7Z46dl8tE2u8kc1Cna/wDrIlUnbjzVQrGJ9ywQ9TAyEAPz02q4d5TY9uE0k xncC+p3LbqOnkWU3rrFrcyPoMTf4NvLHP86g6xd5p4OGVzkmy9XenR689zoiL+TJ8JLt 771SfOApjCTz+a6NmKvJi7DozwifzdQi7Wt1TrCFfyHJSyPv09XJcY5GwSsLc361VBRE QusLHIhkMIpiEoNX88G5T9VhYhrGIo6ENkaUK3+4D4a3v3Cx/Rfyh1Ze/r3eoGzwwDRV MhUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=hrsTCAbz+ofsFk3KXU3EyzUXcikKYOkABLLUZ9LcLV4=; b=Bmif6x8hktUOkbzoGk4ZqYUzV/mcAQE/eWG4VCO3KMmZSFaQr0IWoKNnPim8cb80rD Ph4QhxnqT97tpEcpuPV65L7khQjE0RAl5vsgmPMLSW5NqmYtKDVaGjPnrYDDnI+tvWpg MhFyRtkJqc+nVKPfIRjxNWZmMYb+JNFrd3uAmb/MQn9lsWuGWw3B+PioWkMwdMo3YNQn sXmH+g8igmTHIL8eZ1SoS1sejEfpEvy+/Lhkz7sPWza5XyqMQA6VD+W7yjwQV6jbRW97 bhhDlEbTakVFtuDD/Kj3dOKF8QHnugGLZL9zbydnuypaNIBug74ziTrKLwf72rt4kSP8 DkXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=PNc37wRM; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l9-20020a170902f68900b00153b2d16431si4145022plg.57.2022.03.25.13.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 13:39:25 -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=@linuxfoundation.org header.s=google header.b=PNc37wRM; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D8ED59394; Fri, 25 Mar 2022 13:03:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbiCYUEY (ORCPT + 99 others); Fri, 25 Mar 2022 16:04:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbiCYUDg (ORCPT ); Fri, 25 Mar 2022 16:03:36 -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 2B6091EFE06 for ; Fri, 25 Mar 2022 12:55:37 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id i12so5910739ilu.5 for ; Fri, 25 Mar 2022 12:55:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hrsTCAbz+ofsFk3KXU3EyzUXcikKYOkABLLUZ9LcLV4=; b=PNc37wRMw7rIGTQml+Sy2CvDN585VeAf4M5XfVDXfnIJXC41EiPaUltn5IH2QUr9Eh SI3B+WX+OiXK84CO18BTBogoWhoGPE9IFLkbvA+D+Ih+AMPjTTdFyiAZ92v+gcq/z8tT qPx1T20r+DoLuLuPOGoB/YTkLDbJ5e2hJhpb4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hrsTCAbz+ofsFk3KXU3EyzUXcikKYOkABLLUZ9LcLV4=; b=Vvr7F8J6rkgD6M6UPcxecEN4c+nphhzvxvTwPAvR7xxMDz4Drdc+Mg/Zdcn9wbGIIJ 7mdxOBvR0bnea/Acz6IdGwY09DzzKdFVPREr2TTZFJ211BBGhdStdbFqCEhBTUDK6X0f VvRQtOk4vHRZqhoYmoVpWXmoMz5xfhchsgsPRDvk3SfBW1dj2i9mt10It+EfiVloh35W RU6TP0YlCoprznDWa1QZRkLH/koU3ZKN2Z7kJWwRnIuRdHPdaCwz374Q/7lHrKqPboah /V0aND4Oh15rg+OiWZoPl1BN9CQkAndYDJLrfaSkkOR6UgRztoZwZYzBCD6JmsbisAsd 09Og== X-Gm-Message-State: AOAM5323f9jYZWU+KzwIReF/c+sP977C1pL4c0nMkUXoV7HOlatJJgES lHiZ3T7n8zYj8uVMbI2VkrlxfQ== X-Received: by 2002:a05:6e02:18cb:b0:2c7:fdad:31b8 with SMTP id s11-20020a056e0218cb00b002c7fdad31b8mr160984ilu.123.1648238137038; Fri, 25 Mar 2022 12:55:37 -0700 (PDT) Received: from [192.168.1.128] ([71.205.29.0]) by smtp.gmail.com with ESMTPSA id l19-20020a056e020e5300b002c866dfd494sm3212745ilk.21.2022.03.25.12.55.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 12:55:36 -0700 (PDT) Subject: Re: [PATCH] selftests/bpf: Fix warning comparing pointer to 0 To: Haowen Bai , shuah@kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org Cc: linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <1648087725-29435-1-git-send-email-baihaowen@meizu.com> From: Shuah Khan Message-ID: <29503ac1-69ab-a0b7-53bc-5a7522baa289@linuxfoundation.org> Date: Fri, 25 Mar 2022 13:55:35 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <1648087725-29435-1-git-send-email-baihaowen@meizu.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 3/23/22 8:08 PM, Haowen Bai wrote: > Avoid pointer type value compared with 0 to make code clear. > Patch looks good to me. Please include the error/warn message in the commit log. This gives reviewers information on how this problem is found. > Signed-off-by: Haowen Bai > --- > 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; > With the change to commit log including the error/warn message and details on how the problems is found: Reviewed-by: Shuah Khan thanks, -- Shuah