Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1491850iog; Tue, 14 Jun 2022 07:09:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s0PhmC3NW2dnZokuM566GUcSp+mjsiMm8VHT4Wb0c0AwvQQfPP1mAi7srhxyZPtO6DYYo/ X-Received: by 2002:a17:907:3f88:b0:711:d5a6:105 with SMTP id hr8-20020a1709073f8800b00711d5a60105mr4503410ejc.727.1655215775743; Tue, 14 Jun 2022 07:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655215775; cv=none; d=google.com; s=arc-20160816; b=MchuLG8aDZyP9Y0WIWhNuJhKqgCzOBlVDO6JoeRltPD/uZiRgfcUUYL2VWZTY594MW 2B46/UKhVi5s4YRt+7R6GwzfBYcqeELE+UshT+1xH6D0P13QZjiU0fjFNxoHDaTSxj9C fsJ8aOMUAqrbivvjS99646lLzyRm8tCshl09f3PITcjBw4M1iFIzlkgUXbgr7Y9dQ0Ba l3c/iSy6MYG6WJ5BmRLxm+Z/6AtWUxythfu1B3Zt/d4LjmuUYfrJ5FW8juYdIw0XpzHM AeOOMyu4LLQrKKphW2UUKudStxKfD1NgwaO40orJubvxLysir9+MuzwnrQtl5BGGgR16 uMnA== 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=TBZRXsIUgPrwK41uYl0qFR1bA9XKQJ6Wd9marZHiA5E=; b=r2NzvhdBLNc7zXTVyMwNzJH4ap9uLt7QfsRqs54d42QCkChKBh5yLWauZzIoZ1UKzz FlKk4K3Rj6BRKkTxX3tlfACp2H1NilJNBLXwZcG0LUw4+NpfAHpmfFeusyNgioKcsiR6 MDj3sVKq/K2nwBPnhGjwKED3hbaxqnkRae0y+whqCU9HXSUDAXpq8P16swxQz6/OHTxU cQle9rUe0rK9y7+m8uSMKNx6ApR36DvMVWAxR/byQb7S67ymG2mavD8ZxSXKn2FZxCbo xCEicJYEgtvkWGgt7+BqelJZg8uWELXHXHKtl0pbsiWu9G6VRzvs0eWhUsLjPzilUhGB RWkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="By224uq/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x89-20020a50bae2000000b0042ff2610405si12668778ede.469.2022.06.14.07.09.08; Tue, 14 Jun 2022 07:09:35 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="By224uq/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245624AbiFNNhC (ORCPT + 99 others); Tue, 14 Jun 2022 09:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235958AbiFNNhA (ORCPT ); Tue, 14 Jun 2022 09:37:00 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AE021CB11; Tue, 14 Jun 2022 06:36:59 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id m20so17188395ejj.10; Tue, 14 Jun 2022 06:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TBZRXsIUgPrwK41uYl0qFR1bA9XKQJ6Wd9marZHiA5E=; b=By224uq/sOnAN+s/z0vVcdF/6dNVvBSlBCxxMi+6rjH2FYK0e6mYiUsjpegUOxN8jt q7Mps9QkZVv9hRt+INZjJnFH+MNWrT1ztkWnYYl+8NjxrhrXAOklb14sf1yLgSZbREc5 cm/DwAA1mqb87u0tpnvtYB/WHO6xStksUnENFVBsEvBJQsvHXpvqZMWSGp/AVETVLWDe Y7WKbzYJcz8ZFFs5zQTanGkX3rXkrBCxGuDNKWYdFk5MMhrlp8PmYj2kuXMhw9IvOwF9 CKanayB/4E+Htk9g8QfVIQ5wkbgwrNzF0zz0qjg4Qh4UWFt2Jp9qtOGSDj2of0hBbcnR O8PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TBZRXsIUgPrwK41uYl0qFR1bA9XKQJ6Wd9marZHiA5E=; b=Pl5vZsRgDtTslSSW2JBerDEmceUwhuL3nCEDfPdZFutLJAylrbASe57uFx2IuhaH/2 jeoKHpboIi/UvLf1NDNIiNFlEZt77nLcdeMACcVHrLupaxCC8Wp7nTWI04zqSg/iUxSw EpSGuKBNotCVOuAuNlMD7eLICOfiV1JzUtJ7zklav7fzcYW/dOtKScvWYI6hTLrIXCjH O1a0bPdwuQkjwoW+dWmEJoIzRdmuCxXVCzAhJLK/TrShFT0aolHluLZAKoQLvc/LaZ9P Shv0xelw6Bsi9goAkqb/WvzeHzqSGgcHmNx7XP2coBaH8c8ANAxoxCWMfXpvhazx2q6j JrvQ== X-Gm-Message-State: AOAM530JfaB3uVd8JZ07BMhwFs4Uhjltyh4vKOYjvnWUMbjjEft9XZCd GX8GGsT3UirVE4EdDO78edlD2iKrYQ17FcrBhKk= X-Received: by 2002:a17:906:3c07:b0:718:e1a7:b834 with SMTP id h7-20020a1709063c0700b00718e1a7b834mr690062ejg.635.1655213817548; Tue, 14 Jun 2022 06:36:57 -0700 (PDT) MIME-Version: 1.0 References: <20220614085035.122521-1-dzm91@hust.edu.cn> <87zgifihcd.fsf@redhat.com> In-Reply-To: <87zgifihcd.fsf@redhat.com> From: Dongliang Mu Date: Tue, 14 Jun 2022 21:36:22 +0800 Message-ID: Subject: Re: [PATCH] x86: kvm: remove NULL check before kfree To: Vitaly Kuznetsov Cc: Dongliang Mu , Paolo Bonzini , Sean Christopherson , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org, linux-kernel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 On Tue, Jun 14, 2022 at 8:01 PM Vitaly Kuznetsov wrote: > > Dongliang Mu writes: > > > 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); > > Reviewed-by: Vitaly Kuznetsov Thanks for your review. My signature seems with an incorrect format, so I send a v2 patch. > > -- > Vitaly >