Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1144333pxb; Wed, 1 Sep 2021 18:55:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCy8HRxZBs6z8KZMwvWUqcTZdw41QjSLJ7CwkRcjxpKOkbhi/CPJJBMPB0F2IDePyoypmS X-Received: by 2002:a05:6e02:1d95:: with SMTP id h21mr501067ila.231.1630547718025; Wed, 01 Sep 2021 18:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630547718; cv=none; d=google.com; s=arc-20160816; b=rtOQ7krG9EC17IZdCAS9C3IWgyJkmkpSWcFcER8sHG+m/da2mMK0fQ9hB8Ck9mcrfE 2yQpIuw3F/mVLas0DEnKd+atAqPkZaFuEoz13QtzrjzW/Ct/sW1p2a+DSFFbkpnwY2o8 d/4ZtUitpLXQQXBWvCF0gAJEU10Hj9n1Apx+J7cbt8UhNdaqAvMR3R7oAj5pQH8o+YBb n0PMQVo/Iu0hw0CMOSWPuzBMPurFILuq6Z+UQfnFrlQ3l9xv33GfCl4vJeWMd+0g9yvh 8hmuoSpbstbfEIbPcqNWODoEgjlcFXuoDHUzPVbIhCmD6gSZ/CZFSyN1JjpGoYiFcI4H 7LAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=KIxss2xOop0SJPjr/ho0FKd3VhafmqdD3Ky3BkwHRFE=; b=k9bDtbXeTetKRFlyswh0sqX0kfLiCJlJytdPak5nddKO6ED3yW6CxnoMqeg6NEdnyl lcAyeAsBcKQDYDYjsx7ha9Tf4Whi+82OG7vRxj9JlErtZx7f8rKCrneKlaxyhU+Ab3s0 KEf1pa7Wspe2PH5MLg3W/eAfSarozOBrrtxe2+kerRFLT1+SgkUnLRgUDHESKGSBBWJI rjPfB/VPHWHQ13YprXSo0Y/QdWxLGVyXGjAwaXKX4HQ4dUloFoUYfqaEIaB90q3WejaS TKx8Z2tVTlOL18TeHxZ2QHXXBUYnGQ3VGAjt6da3S7Y8w4PizhaMJ4Ew75r05O6YCrzt 5BjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h5si331606jaa.119.2021.09.01.18.55.05; Wed, 01 Sep 2021 18:55:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231429AbhIBBwz (ORCPT + 99 others); Wed, 1 Sep 2021 21:52:55 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:50934 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229910AbhIBBwy (ORCPT ); Wed, 1 Sep 2021 21:52:54 -0400 X-Greylist: delayed 332 seconds by postgrey-1.27 at vger.kernel.org; Wed, 01 Sep 2021 21:52:53 EDT Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-01 (Coremail) with SMTP id qwCowACXeHHXLDBhbQY2AQ--.58084S2; Thu, 02 Sep 2021 09:46:02 +0800 (CST) From: jiasheng To: linux-kernel@vger.kernel.org Cc: jiasheng Subject: [PATCH 9/9] x86/microcode/amd: Add __list_del_entry_valid() in front of __list_del() in free_cache() Date: Thu, 2 Sep 2021 01:45:56 +0000 Message-Id: <1630547156-3731187-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: qwCowACXeHHXLDBhbQY2AQ--.58084S2 X-Coremail-Antispam: 1UD129KBjvdXo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fOwUUUUU= X-Originating-IP: [124.16.138.128] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have found that in the complied files __list_del() appear more than 100 times, and under at least 90% circumstances that __list_del_entry_valid() and __list_del() appear in pairs. For example, they appear together in the __list_del_entry() of the header file, 'include/linux/list.h'. But we have found that in the free_cache(), there is only __list_del() instead of the pair. Therefore, we consider that the __list_del_entry_valid() might be forgotten. Signed-off-by: jiasheng --- arch/x86/kernel/cpu/microcode/amd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 3d4a483..1987ee1 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -626,6 +626,8 @@ static void free_cache(void) struct ucode_patch *p, *tmp; list_for_each_entry_safe(p, tmp, µcode_cache, plist) { + if (!__list_del_entry_valid(p->plist)) + continue; __list_del(p->plist.prev, p->plist.next); kfree(p->data); kfree(p); -- 2.7.4