From patchwork Fri Dec 20 14:21:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11305585 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 448BF14F6 for ; Fri, 20 Dec 2019 14:22:40 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AD34206A5 for ; Fri, 20 Dec 2019 14:22:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AD34206A5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iiJ9s-0004mQ-Vd; Fri, 20 Dec 2019 14:21:36 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iiJ9s-0004mH-0H for xen-devel@lists.xenproject.org; Fri, 20 Dec 2019 14:21:36 +0000 X-Inumbo-ID: 02287f18-2334-11ea-b6f1-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 02287f18-2334-11ea-b6f1-bc764e2007e4; Fri, 20 Dec 2019 14:21:27 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8E4E3B24A; Fri, 20 Dec 2019 14:21:26 +0000 (UTC) To: "xen-devel@lists.xenproject.org" From: Jan Beulich Message-ID: <8b611419-a0c7-743f-fec4-f02a04caf114@suse.com> Date: Fri, 20 Dec 2019 15:21:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 Content-Language: en-US Subject: [Xen-devel] [PATCH] x86/EPT: adjustments for redundant function arguments X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Wei Liu , George Dunlap , Andrew Cooper , Jun Nakajima , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In ept_p2m_type_to_flags() passing in type and access as separate parameters can be considered an optimization, as all callers set the respective fields in the entry being updated before the call. Retain this behavior but add assertions. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -75,7 +75,8 @@ static void ept_p2m_type_to_flags(struct * D bit is set for all writable types in EPT leaf entry, except for * log-dirty type with PML. */ - switch(type) + ASSERT(type == entry->sa_p2mt); + switch ( type ) { case p2m_invalid: case p2m_mmio_dm: @@ -143,9 +144,9 @@ static void ept_p2m_type_to_flags(struct break; } - /* Then restrict with access permissions */ - switch (access) + ASSERT(access == entry->access); + switch ( access ) { case p2m_access_n: case p2m_access_n2rwx: