Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1388569rdh; Mon, 25 Sep 2023 11:09:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3ZVWmFqURVD0CFNoZ3RU+sFP47cXodDnxUqnJmkoPOFnImlUrMq3NgsDY9Q6i8srERCeL X-Received: by 2002:a05:6e02:de1:b0:349:88c3:a698 with SMTP id m1-20020a056e020de100b0034988c3a698mr8667889ilj.16.1695665340891; Mon, 25 Sep 2023 11:09:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695665340; cv=none; d=google.com; s=arc-20160816; b=pswc6R+vISTbv9JrbgsiQEEb+NJyI399SzDEdpHEBEMaU1L3v6kmM+Hj4XsEy/f2UB Xe1S9vGnWOJ6Xx/WvjxGHBGGLuvVDI+QAHYldpTtqospq81OOONdyU0fx08dlnQvR/PD OHJzEpqlHQEAizQlmvqwm0zQHfj1jn1RxUOTkrDrk4FGYa/dfDcjzXbCosoGzNIV1q7H cr+qV9sezNg25FyxX7tf6N/kJUmFCHwrTUbRExvx9qC0N89snxYKnu0Q9hE2DMlHILCD pNG96JF1ZDWQdlIBoJq7EqIMjJBYj4QJtLODnXfgavcD9RKvVRiWPbCSFpNE5DEfhNBv mBtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=BUg2X353Fl58jpK3Y6ShyJWRqNCsmVqPX4bnLWdfAnA=; fh=TyS5kJZZxFFT5s5VgB6XLc2H7w96LaqGcFuCa2DjH4Q=; b=BsdAYDMWLrUUuQDK51mjB/mQW/ca9xXAKyXM+fmuJDhXwQIpye6PSWx8v1OmqoGhz2 At5pbhup7GA2OLqHIR/76UvgCz3EuYUvW3U8ZLL4a0gjd0qzdV/pGA0zxNRmfGGKFbXn NU17QSouwypwoY2UBqMgErvHZpxTpXK6cH4IPStvX8Jd+oWLi5jM32VlELz+bSVHGczg 5OewPRkl/1ROtD7CsYC7W27R4zlZ2rmtBsgnkNlAGy7TIKp/R6c0Puc4GF16H5BkM81a 9NI1gSRc3kBJvGApPpGgrEKSt/WQdeWIlioqPMSjF8oaLO6JN6CyuiJlb/K1qiKA0pzu IGDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eBkZJQ0x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id h11-20020a65480b000000b00578a9192d91si10498338pgs.696.2023.09.25.11.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 11:09:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eBkZJQ0x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8B26E807CF7F; Mon, 25 Sep 2023 08:45:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232828AbjIYPoq (ORCPT + 99 others); Mon, 25 Sep 2023 11:44:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233148AbjIYPod (ORCPT ); Mon, 25 Sep 2023 11:44:33 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F6E10C8 for ; Mon, 25 Sep 2023 08:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695656643; x=1727192643; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=IsKAFDVkc6Yshx99cT54U4R8LdSEzrQJc7xqTqqxN3g=; b=eBkZJQ0x5WMb3pHzkvCZcV1eR1rI97OVxx8Ejzay4rc9FFaetBOWE7sw 3PN+IbaOWYBQX32F0xIFYfgV8cuPqVQdHrHx/DoC9rrKtCJkdbcu5hH8C rYfrkE2AP4REJJGaOZmSyg6mrHd28kJCXiglvJ5grcokngMyZOM/ayUql CV4wTy9LtKSu9WxDCP02ZSA8AVgLcyiDjGU2Kb9Mh52XRu/r1TtePphkD I0g19nsIR0pb4wPDEp40a0tH3CpVzn54zELH+7+Y5MTszc5IVVi9K01XX Kj6hyd7dbgXqEsUGU2OvdzTo5gjD+c9V0JL3YXtFOYU0Y3zEN0iOX6Tiu w==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="360664873" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="360664873" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 08:43:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="818661690" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="818661690" Received: from qiuxu-clx.sh.intel.com ([10.239.53.109]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 08:43:39 -0700 From: Qiuxu Zhuo To: tglx@linutronix.de Cc: arjan@linux.intel.com, bp@alien8.de, chang.seok.bae@intel.com, linux-kernel@vger.kernel.org, nik.borisov@suse.com, x86@kernel.org, qiuxu.zhuo@intel.com Subject: Re: Subject: [patch V3 09/30] x86/microcode/intel: Switch to kvmalloc() Date: Mon, 25 Sep 2023 23:43:33 +0800 Message-Id: <20230925154333.55668-1-qiuxu.zhuo@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230912065501.335403273@linutronix.de> References: <20230912065501.335403273@linutronix.de> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:45:12 -0700 (PDT) > ... > From: Thomas Gleixner > > Microcode blobs are getting larger and might soon reach the kmalloc() > limit. Switch over kvmalloc(). > > Signed-off-by: Thomas Gleixner > > --- > arch/x86/kernel/cpu/microcode/intel.c | 50 +++++++++++++++++----------------- > 1 file changed, 26 insertions(+), 24 deletions(-) > --- > --- a/arch/x86/kernel/cpu/microcode/intel.c > +++ b/arch/x86/kernel/cpu/microcode/intel.c > ... > static void save_microcode_patch(struct microcode_intel *patch) > { > - struct microcode_intel *mc; > + unsigned int size = get_totalsize(&patch->hdr); > + struct microcode_intel *mc = NULL; No need to initialize the 'mc' to NULL as it's unconditionally set by the following kmemdup(). > > - mc = kmemdup(patch, get_totalsize(&patch->hdr), GFP_KERNEL); > + mc = kvmemdup(patch, size, GFP_KERNEL); > if (mc) > update_ucode_pointer(mc); > + else > + pr_err("Unable to allocate microcode memory size: %u\n", size); > } > > ...