Message ID | 10ee62bd.c2.1844d7ee28a.Coremail.wangkailong@jari.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1546277wru; Sun, 6 Nov 2022 07:27:34 -0800 (PST) X-Google-Smtp-Source: AMsMyM4EbJxcnskZR5wQvWQNwvcKmG3GMfLNHFfmLTqRoXNKTPkYD+iAxmOL2inG0H9nxdeXmgxd X-Received: by 2002:a05:6402:1382:b0:464:1e50:1a41 with SMTP id b2-20020a056402138200b004641e501a41mr20899618edv.245.1667748454651; Sun, 06 Nov 2022 07:27:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667748454; cv=none; d=google.com; s=arc-20160816; b=PxWSaHkVdaL4JCQzXAhmxHbCCweJ1uHDBRIeMG+4t1dRPohHC/8KNEqTq3cBcQxqIW /jdeHQbCfH/lir9o6nhRT3TcsEuw0xQKK+7HQG/06Sgsr5SxefycYPIhM2dgAKgR7jKG uKajttKwmfv8Mo0T+D2MCc9PHiTKJrVvnBgWaVbgyHmFTJjbmKi276jTSN1QcyUDmEXG Yau2FPwpi4oLmGqZhVjwabAo71Rew873S3P4cybdlDmmlxFBTV27qQJJvyK96BfpU64b Qi29lc/s5wGybDi33bvD2puZcN3K88SB0mGmI+G3LwhkLf2fRPD2+gYNAv8r6W9dnmAZ w2qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version :content-transfer-encoding:subject:to:from:date; bh=Cw2qMSHxoZaUTLw2BAcQ+K3fBnmW7bVjnBCInRpTSYM=; b=Qen/UWBKAWAW7scmW9/fUnP8bTkgxElpvNduFYlZ+4QwuacJWgOInqTm3meIX81i9a vR4db3ToV4PyUjijNstM+zIfZwD2ePUMp9bUHe6ObTK3q/2urf9KA9wGgnXA3BojmEAC UfaHQ3SKAtcJvLaj/TVY3SG2ylzaN04ZsnxQ85Wqb0aT3WMRtqWeYUeSgwmcdX8r5MNU fjA6CBqKUScYzfNtnc/aT2+hZjvAzO8sJS+mcy3lAJowHAD5K69UBt6SrHCnr9JQYjY6 bMI94rgSoVPE4CAymxaCBWgDeQF+nXCFs7ygGiOWzQdzXNVvLCyGYv9iMqKnrEIylYgb QM5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j8-20020aa7c0c8000000b00458e689f41fsi5344598edp.415.2022.11.06.07.27.10; Sun, 06 Nov 2022 07:27:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbiKFPQD (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Sun, 6 Nov 2022 10:16:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbiKFPQC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 6 Nov 2022 10:16:02 -0500 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 33A4DBF5A for <linux-kernel@vger.kernel.org>; Sun, 6 Nov 2022 07:16:01 -0800 (PST) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sun, 6 Nov 2022 23:11:12 +0800 (GMT+08:00) X-Originating-IP: [182.148.13.29] Date: Sun, 6 Nov 2022 23:11:12 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: linux-kernel@vger.kernel.org Subject: [PATCH] recordmcount: Fix warning comparing pointer to 0 X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.1 build 20210329(c53f3fee) Copyright (c) 2002-2022 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn Content-Transfer-Encoding: base64 Content-Type: text/plain; charset=UTF-8 MIME-Version: 1.0 Message-ID: <10ee62bd.c2.1844d7ee28a.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwCXq+GQzmdj9IsBAA--.50W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQACB2FEYx0CzgADsQ X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00,RCVD_IN_PBL,RDNS_NONE, T_SPF_HELO_PERMERROR,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748761003599094149?= X-GMAIL-MSGID: =?utf-8?q?1748761003599094149?= |
Series |
recordmcount: Fix warning comparing pointer to 0
|
|
Commit Message
KaiLong Wang
Nov. 6, 2022, 3:11 p.m. UTC
Fix the following coccicheck warning:
scripts/recordmcount.c:142:13-14: WARNING comparing pointer to 0.
Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
scripts/recordmcount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Le 06/11/2022 à 16:11, wangkailong@jari.cn a écrit : > Fix the following coccicheck warning: > > scripts/recordmcount.c:142:13-14: WARNING comparing pointer to 0. > > Signed-off-by: KaiLong Wang <wangkailong@jari.cn> > --- > scripts/recordmcount.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c > index cce12e1971d8..750f5196608c 100644 > --- a/scripts/recordmcount.c > +++ b/scripts/recordmcount.c > @@ -139,7 +139,7 @@ static ssize_t uwrite(void const *const buf, size_t const count) > static void * umalloc(size_t size) > { > void *const addr = malloc(size); > - if (addr == 0) { > + if (addr) { Hi, this change looks incorrect. if (!addr) maybe? CJ > fprintf(stderr, "malloc failed: %zu bytes\n", size); > file_append_cleanup(); > mmap_cleanup();
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index cce12e1971d8..750f5196608c 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c @@ -139,7 +139,7 @@ static ssize_t uwrite(void const *const buf, size_t const count) static void * umalloc(size_t size) { void *const addr = malloc(size); - if (addr == 0) { + if (addr) { fprintf(stderr, "malloc failed: %zu bytes\n", size); file_append_cleanup(); mmap_cleanup();