[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v11 9/9] xen: explicit casts when DECLARE_BOUNDS cannot be used
>>> On 05.03.19 at 23:38, <sstabellini@xxxxxxxxxx> wrote: > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -976,7 +976,8 @@ void __init noreturn __start_xen(unsigned long mbi_p) > * respective reserve_e820_ram() invocation below. > */ > mod[mbi->mods_count].mod_start = virt_to_mfn(_stext); > - mod[mbi->mods_count].mod_end = __2M_rwdata_end - _stext; > + mod[mbi->mods_count].mod_end = (uintptr_t)__2M_rwdata_end - > + (uintptr_t) _stext; Did you consider changing __2M_rwdata_end's declaration and using text_bytediff() here? Otherwise, if the casts are to stay, the stray blank after the second one should go away. > --- a/xen/common/virtual_region.c > +++ b/xen/common/virtual_region.c > @@ -119,7 +119,9 @@ void __init setup_virtual_regions(const struct > exception_table_entry *start, > const struct bug_frame *s; > > s = bug_frames[i - 1]; > - sz = bug_frames[i] - s; > + /* bug_frame[i] and s are pointers to different objects. */ > + sz = ((uintptr_t)bug_frames[i] - (uintptr_t)s) / > + sizeof(struct bug_frame); I disagree with the comment, and if you think it is correct, then no matter what you do the behavior is undefined. Instead I view the entirety of the .bug_frames.* sections as a single array, with labels placed not only at start and end, but also in the middle. I think the code here would better also be taken care of by the DECLARE_BOUNDS() machinery, dividing the single array into multiple smaller ones. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |