All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Shane Wang <shane.wang@intel.com>,
	Joseph Cihula <joseph.cihula@intel.com>,
	Gang Wei <gang.wei@intel.com>
Subject: Re: [PATCH 2/2] x86/tboot: simplify DMAR table copying
Date: Wed, 18 Feb 2015 10:41:24 +0000	[thread overview]
Message-ID: <54E46C54.1050302@citrix.com> (raw)
In-Reply-To: <54E4637F0200007800060EE5@mail.emea.novell.com>

On 18/02/15 09:03, Jan Beulich wrote:
> There's no need for more than one variable, no need for casts, and no
> point in using the type-safe xmalloc_array() here.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/arch/x86/tboot.c
> +++ b/xen/arch/x86/tboot.c
> @@ -435,13 +435,12 @@ int __init tboot_protect_mem_regions(voi
>  
>  int __init tboot_parse_dmar_table(acpi_table_handler dmar_handler)
>  {
> -    struct acpi_table_header *dmar_table;
>      int rc;
>      uint64_t size;
>      uint32_t dmar_table_length;
>      unsigned long pa;
>      sinit_mle_data_t sinit_mle_data;
> -    unsigned char *dmar_table_raw;
> +    void *dmar_table;
>  
>      if ( !tboot_in_measured_env() )
>          return acpi_table_parse(ACPI_SIG_DMAR, dmar_handler);
> @@ -474,13 +473,12 @@ int __init tboot_parse_dmar_table(acpi_t
>      tboot_copy_memory((unsigned char *)&dmar_table_length,
>                        sizeof(dmar_table_length),
>                        pa + sizeof(char) * ACPI_NAME_SIZE);
> -    dmar_table_raw = xmalloc_array(unsigned char, dmar_table_length);
> -    tboot_copy_memory(dmar_table_raw, dmar_table_length, pa);
> -    dmar_table = (struct acpi_table_header *)dmar_table_raw;
> +    dmar_table = xmalloc_bytes(dmar_table_length);
> +    tboot_copy_memory(dmar_table, dmar_table_length, pa);
>      __set_fixmap(FIX_TBOOT_MAP_ADDRESS, 0, 0);
>  
>      rc = dmar_handler(dmar_table);
> -    xfree(dmar_table_raw);
> +    xfree(dmar_table);
>  
>      /* acpi_parse_dmar() zaps APCI DMAR signature in TXT heap table */
>      /* but dom0 will read real table, so must zap it there too */
>
>
>

  reply	other threads:[~2015-02-18 10:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18  8:56 [PATCH 0/2] x86: tboot adjustments Jan Beulich
2015-02-18  9:03 ` [PATCH 1/2] x86/tboot: invalidate FIX_TBOOT_MAP_ADDRESS mapping after use Jan Beulich
2015-02-18 10:40   ` Andrew Cooper
2015-03-05  4:45   ` Wei, Gang
2015-03-05  7:14     ` Jan Beulich
2015-03-06  7:45       ` Wei, Gang
2015-02-18  9:03 ` [PATCH 2/2] x86/tboot: simplify DMAR table copying Jan Beulich
2015-02-18 10:41   ` Andrew Cooper [this message]
2015-03-05  4:47   ` Wei, Gang
2015-03-04  7:28 ` Ping: [PATCH 0/2] x86: tboot adjustments Jan Beulich
     [not found]   ` <9F57BF860713DF4BA3EFA4F8C6DFEDAC9AD71F89@ORSMSX110.amr.corp.intel.com>
2015-03-04  8:22     ` Jan Beulich
2015-03-04  8:26       ` [PATCH] drop Joseph Cihula from TXT section Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54E46C54.1050302@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=gang.wei@intel.com \
    --cc=joseph.cihula@intel.com \
    --cc=shane.wang@intel.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.