Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp907853rwi; Thu, 27 Oct 2022 08:53:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JShI2XFOUmt8ktes8wWUDUhq5sSCuztpO7Cm23PQ34Tev/jM9ebDV3mBHeIPm8NOYUbJd X-Received: by 2002:a17:906:3287:b0:78d:8877:d50f with SMTP id 7-20020a170906328700b0078d8877d50fmr42383472ejw.486.1666885980570; Thu, 27 Oct 2022 08:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666885980; cv=none; d=google.com; s=arc-20160816; b=U9HSMkHWfRncj9rZtd1a4DZOK3cFMxzB6o+J0kntg+OZ4ZEnGOKhvApTB2Uq12AB+W 7+SBR7E+Uyx9qCtX/J4k39IQSlrrYWoLNrx2wZ7sNAjdi+ck9WFleW3DRuzhyiyvhWse GGHo+mRCXOi1/ypF89KA2X+ED4bT0TSGfoX2oUlH2Tsgj7dhZZ2REpWzxc9iVClczjGv atgHl8oAeY2fo1mEgQ5TkMIyeTvZsOYx65lolufL0S45R26ljtWBf7a0ZI5fAOzRUxc6 X+oe8VaBlf/UwGPQdeXqjxcmf0QTKzOu2zC/N3ttCMmfnw8ASHTrlMray7MZXLNN1HUy gcMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=dm3hyAIkcss8/Gr8tTEtCGAiscFU16n0cXb9wmpJil4=; b=1Icbi+HmoK+U/ocgUPtfVstQDAnWhPaTaAqWILSLpj/R3UiBp/DNsj9guuroRSbRn/ y/5qHKepVq5le4eRVI/770YOmmJM9jJlAQhnSNFPAE15/A3YB1PSrj+4YjFylh2fapEb q3nA/PvATer4sA6SElxkGmkKJNxWsneSRvrOymd63zsvLaX8tzWPeO5mjml1b5Nf/laq zCWaifkxOyEsXMdWjssXxGjfp0trX9bx2C7yL3oEMu35n6v+AEXw+1/xW6Z4z/3/P2pA nBNJEkROO0/bvX4+rdO+emuYkop8EGC6P/DcXymRY0OTQy7bSmjr+4oZ2v2KZFksyxbv Tf/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UFp3F+lG; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz6-20020a1709077d8600b0079744630e4asi1563817ejc.780.2022.10.27.08.52.35; Thu, 27 Oct 2022 08:53:00 -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=@intel.com header.s=Intel header.b=UFp3F+lG; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235658AbiJ0Pbc (ORCPT + 99 others); Thu, 27 Oct 2022 11:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235566AbiJ0Pba (ORCPT ); Thu, 27 Oct 2022 11:31:30 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65A5572EF6; Thu, 27 Oct 2022 08:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666884689; x=1698420689; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=lVOCRVi28t80YbE9BOPdmWO5P2frCwjii9hGrK7ApE0=; b=UFp3F+lGqlXF2t9LpNUvKuYnWks4Vu3lcQSZHK8RoqzZtponzof/QULE X7oKSXFAfMGaR0fzYAMyseUUsoKLenaiNULM5TLzpaKtLmaouVcJA9qrE qs2Ix3WSRE2ruH66ha5ZWezIWAPjJQaO8jY54XZs+OcZjxI4aycIgd6Xx W0UQ1zh4p4XWYQ4WSR20yOCuEIkAAlmodfTnwQRTy5W2rAfMzmYHfPiZN RPL0S1E/MlfJZME2p5x/JJA0M0QR931BzOSNJhJ1DhhELVibWxu2LXZit A+BoU0ad83Lz66S32hleoM+TQ4ecxpZWdd/IhnoCq8hrvdcU+fRgpHw0r w==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="287972459" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="287972459" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 08:31:26 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="961663589" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="961663589" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.251.5.115]) ([10.251.5.115]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 08:31:22 -0700 Message-ID: Date: Thu, 27 Oct 2022 08:31:21 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH v6 12/21] x86/virt/tdx: Add placeholder to construct TDMRs to cover all TDX memory regions Content-Language: en-US To: Kai Huang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: linux-mm@kvack.org, seanjc@google.com, pbonzini@redhat.com, dave.hansen@intel.com, dan.j.williams@intel.com, rafael.j.wysocki@intel.com, kirill.shutemov@linux.intel.com, reinette.chatre@intel.com, len.brown@intel.com, tony.luck@intel.com, peterz@infradead.org, isaku.yamahata@intel.com, chao.gao@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, bagasdotme@gmail.com, sagis@google.com, imammedo@redhat.com References: From: Andi Kleen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE 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 > +/* Calculate the actual TDMR_INFO size */ > +static inline int cal_tdmr_size(void) > +{ > + int tdmr_sz; > + > + /* > + * The actual size of TDMR_INFO depends on the maximum number > + * of reserved areas. > + */ > + tdmr_sz = sizeof(struct tdmr_info); > + tdmr_sz += sizeof(struct tdmr_reserved_area) * > + tdx_sysinfo.max_reserved_per_tdmr; would seem safer to have a overflow check here.