Skip to contentSkip to conversation

xsm: rework policy_buffer globals

PATCH Jan Beulich 1 participant 1 message Jul 8, 2016

lore
Share & tools
lore

Jan Beulich

author Reviewed-by
#0 lore raw

(Re-sending, as I got two bounces)

xen/xsm/flask/hooks.c static struct xsm_operations flask_ops = { · line 1818

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 07.07.16 at 17:35, <[email protected]> wrote:
xen/xsm/flask/hooks.c +1 -1
@@ -1815,7 +1815,7 @@ static struct xsm_operations flask_ops = {
     .xen_version = flask_xen_version,
 };
 
-__init void flask_init(void)
+__init void flask_init(const void *policy_buffer, size_t policy_size)

Please take the opportunity and move the __init to its more conventional place:

void __init flask_init(const void *policy_buffer, size_t policy_size)

Quoted 20 lines
xen/xsm/xsm_policy.c +3 -4
@@ -28,13 +28,12 @@
 # include <xen/device_tree.h>
 #endif
 
-char *__initdata policy_buffer = NULL;
-u32 __initdata policy_size = 0;
-
 #ifdef CONFIG_MULTIBOOT
 int __init xsm_multiboot_policy_init(unsigned long *module_map,
                                      const multiboot_info_t *mbi,
-                                     void *(*bootstrap_map)(const module_t *))
+                                     void *(*bootstrap_map)(const module_t *),
+                                     void **policy_buffer,
+                                     size_t *policy_size)
 {
     int i;
     module_t *mod = (module_t *)__va(mbi->mods_addr);

xen/xsm/xsm_policy.c int __init xsm_multiboot_policy_init(unsigned long *module_map, · line 59

Quoted 7 lines
xen/xsm/xsm_policy.c +2 -2
@@ -56,8 +55,8 @@ int __init xsm_multiboot_policy_init(unsigned long *module_map,
 
         if ( (xsm_magic_t)(*_policy_start) == XSM_MAGIC )
         {
-            policy_buffer = (char *)_policy_start;
-            policy_size = _policy_len;
+            *policy_buffer = (char *)_policy_start;
+            *policy_size = _policy_len;

With *policy_buffer now being of type void * I don't think this cast is necessary anymore (or if it is, then it certainly shouldn't needlessly go through char *).

With at least this latter aspect adjusted

Thanks for adding this patch,
Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel