On 07/01/2019 10:52, Jan Beulich wrote: >> diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c >> index 5a3159b..7fc4148 100644 >> --- a/xen/lib/x86/cpuid.c >> +++ b/xen/lib/x86/cpuid.c >> @@ -233,6 +233,112 @@ int x86_cpuid_copy_to_buffer(const struct cpuid_policy >> *p, >> return 0; >> } >> >> +int x86_cpuid_copy_from_buffer(struct cpuid_policy *p, >> + const cpuid_leaf_buffer_t leaves, >> + uint32_t nr_entries, uint32_t *err_leaf, >> + uint32_t *err_subleaf) >> +{ >> + unsigned int i; >> + xen_cpuid_leaf_t data; >> + struct cpuid_leaf *l = (void *)&data.a; > I'd find this cast a little less worrying if you used container_of(). But > even then I dislike this well hidden assumption of similar layouts > of struct cpuid_leaf and the latter parts of struct xen_cpuid_leaf. > > Also it looks as if this could be a pointer to const.
I've found a different way of doing this which actually compiles smaller (contrary to expectation). >> + /* >> + * A well formed caller is expected pass an array with leaves in order, > ... expected to pass ... Fixed. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel