Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1255558iog; Tue, 14 Jun 2022 02:25:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uecwO6J+w2KtuXHRjjAqpdzY9P1kuXmNCL58fvSAjaLfaxcBGaUz12xytFHDeIXoKK5KGV X-Received: by 2002:a17:90b:3c6:b0:1e2:e9fc:4e79 with SMTP id go6-20020a17090b03c600b001e2e9fc4e79mr3651497pjb.192.1655198738960; Tue, 14 Jun 2022 02:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655198738; cv=none; d=google.com; s=arc-20160816; b=vLtL1qa2z7bUv4+tpU+DVIhFxUU9Gv74AkAt3dttEcaa/wO+dHCno4/NawkqImhY6M TGhWL5NIc60TEtNYB85tlWOcAnOHohJRHYNQTdQ176O6H0+vSZa2m1jXhgpaTkXusika 4eiirVZxSZfK49OICtutpMZsI89TqFoppyJFyLI12lUgYoBV1cSTUK8l/0C35g6rFe6S ggMTvQ/cJ+8vjmK9BvwveqbJByfERMZGiroULqlVCpTHxTr0DNnkl43gftndgH/WO1iy 3mh+UkeyW0GlrxSFSsrvrz8wHqIdwU2+MUVn0Wtoefk4kP3tEK/kFpU1g4uBLzkIUXkJ bxeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=gfXSDNmuyw73xbnI1cLIpZYg8mxsHHfaKLk6yFnjQ5w=; b=0zBNu+DwUjKS+xP6fkdG9ACF2bOJ9j/ciVIWidofg8oAEGQA2lpIclwufzG+xk5iZC UeBQAZM51Z4BT95OJNJAYuSnfxWp4Ifk69/DY7j0pncRTrN4T+e5nqNdHZkmHsO7dI/V TveRYSnIvCvJCR3zKSdOKqOIvkxW0yi1/8D4+X80/QudBXzuXfwMFOB0t/Ple6PlkUWo uzlcsEN1zdx2VsCUy6ppNnGGdJ2FinXcNUhjHxtM96XCKiREe35kGinoUIMNL7EcK1UQ T7VadiZgW7NwCJwNbmUcCprqFdpif3mtJv8nlDKTAZEFKGp1NyAMh/Tup01/4dxtipsN 4BDA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o12-20020a635a0c000000b003fd1b9e2d1csi13048484pgb.91.2022.06.14.02.25.27; Tue, 14 Jun 2022 02:25:38 -0700 (PDT) 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 S1355944AbiFNIwx (ORCPT + 99 others); Tue, 14 Jun 2022 04:52:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355881AbiFNIwg (ORCPT ); Tue, 14 Jun 2022 04:52:36 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CB25250; Tue, 14 Jun 2022 01:52:28 -0700 (PDT) Received: from localhost.localdomain ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 25E8ojJ2017587-25E8ojJ5017587 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 14 Jun 2022 16:50:50 +0800 From: Dongliang Mu To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: mudongliang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x86: kvm: remove NULL check before kfree Date: Tue, 14 Jun 2022 16:50:34 +0800 Message-Id: <20220614085035.122521-1-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: dzm91@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: mudongliang kfree can handle NULL pointer as its argument. According to coccinelle isnullfree check, remove NULL check before kfree operation. Signed-off-by: mudongliang --- arch/x86/kernel/kvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 1a3658f7e6d9..d4e48b4a438b 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -236,8 +236,7 @@ void kvm_async_pf_task_wake(u32 token) raw_spin_unlock(&b->lock); /* A dummy token might be allocated and ultimately not used. */ - if (dummy) - kfree(dummy); + kfree(dummy); } EXPORT_SYMBOL_GPL(kvm_async_pf_task_wake); -- 2.35.1