Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5526481imm; Tue, 19 Jun 2018 11:50:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJwK4uZVkRnfz9MDjrax8Nc2vsETFa3/L5aVBXyGYsopjI0a0XmBMWSI3Mj5MgtX3KOXaju X-Received: by 2002:a65:590c:: with SMTP id f12-v6mr16282264pgu.128.1529434225580; Tue, 19 Jun 2018 11:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529434225; cv=none; d=google.com; s=arc-20160816; b=LnEf5H1Tx6jjGBJ9Gr/y2WRD8uMdRRUAjOkEXcdOkfX4S9u64TliGJpHQi/7M3Bq7e DWcHDn66W53vMUTM3Z3GQsaNCdCtsrookbRDH2ylJNtdUcMnGFwMs1St/weHsZZ9WbXX JcGYLKvP4vkyhvJbwym2Ajy800jasD1X9oS3p60ZTvl+jw9Qi7f9Yzcmrd+LarBS3Hx8 sUc6IMl9mYrE1fXeMNSmBeUNXqVgBML4wSiRGIBLFOYVfuhndjE1mL2Qg9XT6eg0hj8N VrPi6aKFoPQ22e1m5QVJO6RQf3cWkUe3VjfxYyuihuFJKx4Dc3ieqLsPXtqKUXtvPemP FcSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=AXn6SR2Ya1kUITn2m7CQnYO/gKGKDfHiXHRf4NBWpmg=; b=HMZ1ZBoUhy5SQr8QL9lnRxPpmlVAE2MrUJmOC8qwxHhNP1YKoKSctVv0QF//cn+7xZ Z4b1uwiaCFVUiI75RJq9YNK/Qpo/cu+1hizsFxAj0fLHB33b6k3cEbjrGVCVVI6QU5i/ Qhm1EDby88aci8zLgXdRyF9l4nsZ1QbvwA91KQe39mWtitHHY1p2wxMFuGM1UCFemDCd JufseJXEZJUHTilDRBYZkA2E0j8xvH969I3Pq41/xrmyInzQqFXo36XZ6bkxZcP+SnPR 2Rbx5tpl5CSY8zrQCKI7tJx8K3oQaxlOe2Egh+SJjiW7dLVn2gepUyPRh823R+edIJVr 28LQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j29-v6si294950pga.195.2018.06.19.11.50.11; Tue, 19 Jun 2018 11:50:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030428AbeFSSrw (ORCPT + 99 others); Tue, 19 Jun 2018 14:47:52 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:39576 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030350AbeFSSrv (ORCPT ); Tue, 19 Jun 2018 14:47:51 -0400 Received: by vps-vb.mhejs.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fVLfJ-0003WN-Br; Tue, 19 Jun 2018 20:47:41 +0200 From: "Maciej S. Szmigiero" To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 7/9] x86/microcode/AMD: Add a reminder about PATCH_MAX_SIZE macro Date: Tue, 19 Jun 2018 20:47:37 +0200 Message-Id: <81353c66cf069935f275b1265c47c9b5516b2f8e.1529424596.git.mail@maciej.szmigiero.name> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The PATCH_MAX_SIZE macro should contain the maximum of all family patch sizes. Since these sizes are defined in an other place than this macro, let's add a reminder to them so people will remember to verify PATCH_MAX_SIZE correctness when modifying a family patch size or adding a new family. Signed-off-by: Maciej S. Szmigiero --- arch/x86/include/asm/microcode_amd.h | 1 + arch/x86/kernel/cpu/microcode/amd.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index 209492849566..8ea477fbc65f 100644 --- a/arch/x86/include/asm/microcode_amd.h +++ b/arch/x86/include/asm/microcode_amd.h @@ -41,6 +41,7 @@ struct microcode_amd { unsigned int mpb[0]; }; +/* Maximum patch size of all supported families */ #define PATCH_MAX_SIZE PAGE_SIZE #ifdef CONFIG_MICROCODE_AMD diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 2dbdd7951475..9807e27f8fde 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -215,6 +215,9 @@ static bool verify_patch(u8 family, const u8 *buf, size_t buf_size, /* * Check whether patch_size isn't something nonsensically huge so * we don't skip over good patches by mistake. + * + * If you modify these values or add a new one also check whether + * PATCH_MAX_SIZE in include/asm/microcode_amd.h needs updating, too. */ #define F1XH_MPB_MAX_SIZE 2048 #define F14H_MPB_MAX_SIZE 1824