|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 4/4] xen/common: use SYMBOL when required
On Tue, 8 Jan 2019, Jan Beulich wrote:
> >>> On 07.01.19 at 20:16, <sstabellini@xxxxxxxxxx> wrote:
> > On Mon, 7 Jan 2019, Jan Beulich wrote:
> >> >>> On 03.01.19 at 20:19, <sstabellini@xxxxxxxxxx> wrote:
> >> > --- a/xen/common/virtual_region.c
> >> > +++ b/xen/common/virtual_region.c
> >> > @@ -119,7 +119,11 @@ 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;
> >> > + /*
> >> > + * Cast to unsigned long to calculate the size to avoid
> >> > + * subtractions between pointers pointing to different objects.
> >> > + */
> >> > + sz = (unsigned long)bug_frames[i] - (unsigned long)s;
> >>
> >> Perhaps better to use SYMBOL() in the definition of bug_frames[]?
> >
> > That was my initial thought, but then bug_frames cannot be const and
> > cannot be statically initialized.
>
> Oh, indeed. But there's no strong need for the "static", it just
> helps keeping code size small. Without it, none of ...
>
> > So the code would become something like this:
> >
> > void __init setup_virtual_regions(const struct exception_table_entry *start,
> > const struct exception_table_entry *end)
> > {
> > size_t sz;
> > unsigned int i = 0;
> > static unsigned long bug_frames[6];
> > bug_frames[i++] = SYMBOL(__start_bug_frames);
> > bug_frames[i++] = SYMBOL(__stop_bug_frames_0),
> > bug_frames[i++] = SYMBOL(__stop_bug_frames_1),
> > bug_frames[i++] = SYMBOL(__stop_bug_frames_2),
> > #ifdef CONFIG_X86
> > bug_frames[i++] = SYMBOL(__stop_bug_frames_3),
> > #endif
> > bug_frames[i++] = 0;
>
> ... this really looks to be necessary.
Yes, you are right, that works. I'll do that.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |