xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/tboot: adjust UUID check
@ 2021-05-19 15:49 Jan Beulich
  2021-05-28  7:00 ` Ping: " Jan Beulich
  2021-05-31  9:59 ` Lukasz Hawrylko
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2021-05-19 15:49 UTC (permalink / raw)
  To: xen-devel; +Cc: Lukasz Hawrylko, Andrew Cooper, Wei Liu, Roger Pau Monné

Replace a bogus cast, move the static variable into the only function
using it, and add __initconst. While there, also remove a pointless NULL
check.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -27,8 +27,6 @@ static vmac_t domain_mac;     /* MAC for
 static vmac_t xenheap_mac;    /* MAC for xen heap during S3 */
 static vmac_t frametable_mac; /* MAC for frame table during S3 */
 
-static const uuid_t tboot_shared_uuid = TBOOT_SHARED_UUID;
-
 /* used by tboot_protect_mem_regions() and/or tboot_parse_dmar_table() */
 static uint64_t __initdata txt_heap_base, __initdata txt_heap_size;
 static uint64_t __initdata sinit_base, __initdata sinit_size;
@@ -93,6 +91,7 @@ static void __init tboot_copy_memory(uns
 void __init tboot_probe(void)
 {
     tboot_shared_t *tboot_shared;
+    static const uuid_t __initconst tboot_shared_uuid = TBOOT_SHARED_UUID;
 
     /* Look for valid page-aligned address for shared page. */
     if ( !opt_tboot_pa || (opt_tboot_pa & ~PAGE_MASK) )
@@ -101,9 +100,7 @@ void __init tboot_probe(void)
     /* Map and check for tboot UUID. */
     set_fixmap(FIX_TBOOT_SHARED_BASE, opt_tboot_pa);
     tboot_shared = fix_to_virt(FIX_TBOOT_SHARED_BASE);
-    if ( tboot_shared == NULL )
-        return;
-    if ( memcmp(&tboot_shared_uuid, (uuid_t *)tboot_shared, sizeof(uuid_t)) )
+    if ( memcmp(&tboot_shared_uuid, &tboot_shared->uuid, sizeof(uuid_t)) )
         return;
 
     /* new tboot_shared (w/ GAS support, integrity, etc.) is not backwards


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Ping: [PATCH] x86/tboot: adjust UUID check
  2021-05-19 15:49 [PATCH] x86/tboot: adjust UUID check Jan Beulich
@ 2021-05-28  7:00 ` Jan Beulich
  2021-05-31  9:59 ` Lukasz Hawrylko
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2021-05-28  7:00 UTC (permalink / raw)
  To: Lukasz Hawrylko; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné, xen-devel

On 19.05.2021 17:49, Jan Beulich wrote:
> Replace a bogus cast, move the static variable into the only function
> using it, and add __initconst. While there, also remove a pointless NULL
> check.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/x86/tboot.c
> +++ b/xen/arch/x86/tboot.c
> @@ -27,8 +27,6 @@ static vmac_t domain_mac;     /* MAC for
>  static vmac_t xenheap_mac;    /* MAC for xen heap during S3 */
>  static vmac_t frametable_mac; /* MAC for frame table during S3 */
>  
> -static const uuid_t tboot_shared_uuid = TBOOT_SHARED_UUID;
> -
>  /* used by tboot_protect_mem_regions() and/or tboot_parse_dmar_table() */
>  static uint64_t __initdata txt_heap_base, __initdata txt_heap_size;
>  static uint64_t __initdata sinit_base, __initdata sinit_size;
> @@ -93,6 +91,7 @@ static void __init tboot_copy_memory(uns
>  void __init tboot_probe(void)
>  {
>      tboot_shared_t *tboot_shared;
> +    static const uuid_t __initconst tboot_shared_uuid = TBOOT_SHARED_UUID;
>  
>      /* Look for valid page-aligned address for shared page. */
>      if ( !opt_tboot_pa || (opt_tboot_pa & ~PAGE_MASK) )
> @@ -101,9 +100,7 @@ void __init tboot_probe(void)
>      /* Map and check for tboot UUID. */
>      set_fixmap(FIX_TBOOT_SHARED_BASE, opt_tboot_pa);
>      tboot_shared = fix_to_virt(FIX_TBOOT_SHARED_BASE);
> -    if ( tboot_shared == NULL )
> -        return;
> -    if ( memcmp(&tboot_shared_uuid, (uuid_t *)tboot_shared, sizeof(uuid_t)) )
> +    if ( memcmp(&tboot_shared_uuid, &tboot_shared->uuid, sizeof(uuid_t)) )
>          return;
>  
>      /* new tboot_shared (w/ GAS support, integrity, etc.) is not backwards
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/tboot: adjust UUID check
  2021-05-19 15:49 [PATCH] x86/tboot: adjust UUID check Jan Beulich
  2021-05-28  7:00 ` Ping: " Jan Beulich
@ 2021-05-31  9:59 ` Lukasz Hawrylko
  1 sibling, 0 replies; 3+ messages in thread
From: Lukasz Hawrylko @ 2021-05-31  9:59 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné

On Wed, 2021-05-19 at 17:49 +0200, Jan Beulich wrote:
> Replace a bogus cast, move the static variable into the only function
> using it, and add __initconst. While there, also remove a pointless NULL
> check.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 

Reviewed-by: Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-31  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 15:49 [PATCH] x86/tboot: adjust UUID check Jan Beulich
2021-05-28  7:00 ` Ping: " Jan Beulich
2021-05-31  9:59 ` Lukasz Hawrylko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).