* [PATCH] rangeset: make inquiry functions tolerate NULL inputs
@ 2018-08-17 9:20 Jan Beulich
2018-08-17 9:29 ` Roger Pau Monné
2018-08-17 9:51 ` Wei Liu
0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2018-08-17 9:20 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
Ian Jackson, Tim Deegan, Julien Grall
Rather than special casing the ->iomem_caps check in x86's
get_page_from_l1e() for the dom_xen case, let's be more tolerant in
general, along the lines of rangeset_is_empty(): A never allocated
rangeset can't possibly contain or overlap any range.
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -256,6 +256,9 @@ bool_t rangeset_contains_range(
ASSERT(s <= e);
+ if ( !r )
+ return false;
+
read_lock(&r->lock);
x = find_range(r, s);
contains = (x && (x->e >= e));
@@ -272,6 +275,9 @@ bool_t rangeset_overlaps_range(
ASSERT(s <= e);
+ if ( !r )
+ return false;
+
read_lock(&r->lock);
x = find_range(r, e);
overlaps = (x && (s <= x->e));
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rangeset: make inquiry functions tolerate NULL inputs
2018-08-17 9:20 [PATCH] rangeset: make inquiry functions tolerate NULL inputs Jan Beulich
@ 2018-08-17 9:29 ` Roger Pau Monné
2018-08-17 9:41 ` Jan Beulich
2018-08-17 9:51 ` Wei Liu
1 sibling, 1 reply; 5+ messages in thread
From: Roger Pau Monné @ 2018-08-17 9:29 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
Ian Jackson, Tim Deegan, Julien Grall, xen-devel
On Fri, Aug 17, 2018 at 03:20:11AM -0600, Jan Beulich wrote:
> Rather than special casing the ->iomem_caps check in x86's
> get_page_from_l1e() for the dom_xen case, let's be more tolerant in
> general, along the lines of rangeset_is_empty(): A never allocated
> rangeset can't possibly contain or overlap any range.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
LGTM:
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
As said in the commit message, this is done to avoid an extra check in
get_page_from_l1e I assume, so should the extra check also be dropped
here?
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rangeset: make inquiry functions tolerate NULL inputs
2018-08-17 9:29 ` Roger Pau Monné
@ 2018-08-17 9:41 ` Jan Beulich
2018-08-17 9:55 ` Roger Pau Monné
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2018-08-17 9:41 UTC (permalink / raw)
To: Roger Pau Monne
Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
Ian Jackson, Tim Deegan, Julien Grall, xen-devel
>>> On 17.08.18 at 11:29, <roger.pau@citrix.com> wrote:
> On Fri, Aug 17, 2018 at 03:20:11AM -0600, Jan Beulich wrote:
>> Rather than special casing the ->iomem_caps check in x86's
>> get_page_from_l1e() for the dom_xen case, let's be more tolerant in
>> general, along the lines of rangeset_is_empty(): A never allocated
>> rangeset can't possibly contain or overlap any range.
>>
>> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> LGTM:
>
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Thanks.
> As said in the commit message, this is done to avoid an extra check in
> get_page_from_l1e I assume, so should the extra check also be dropped
> here?
I'm afraid I don't understand: I indeed mean to avoid adding a
NULL check in get_page_from_l1e(). But what check are you thinking
of that could be dropped? Or in other words, what is "here" in
your reply?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rangeset: make inquiry functions tolerate NULL inputs
2018-08-17 9:20 [PATCH] rangeset: make inquiry functions tolerate NULL inputs Jan Beulich
2018-08-17 9:29 ` Roger Pau Monné
@ 2018-08-17 9:51 ` Wei Liu
1 sibling, 0 replies; 5+ messages in thread
From: Wei Liu @ 2018-08-17 9:51 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
Ian Jackson, Tim Deegan, Julien Grall, xen-devel
On Fri, Aug 17, 2018 at 03:20:11AM -0600, Jan Beulich wrote:
> Rather than special casing the ->iomem_caps check in x86's
> get_page_from_l1e() for the dom_xen case, let's be more tolerant in
> general, along the lines of rangeset_is_empty(): A never allocated
> rangeset can't possibly contain or overlap any range.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rangeset: make inquiry functions tolerate NULL inputs
2018-08-17 9:41 ` Jan Beulich
@ 2018-08-17 9:55 ` Roger Pau Monné
0 siblings, 0 replies; 5+ messages in thread
From: Roger Pau Monné @ 2018-08-17 9:55 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
Ian Jackson, Tim Deegan, Julien Grall, xen-devel
On Fri, Aug 17, 2018 at 03:41:31AM -0600, Jan Beulich wrote:
> >>> On 17.08.18 at 11:29, <roger.pau@citrix.com> wrote:
> > As said in the commit message, this is done to avoid an extra check in
> > get_page_from_l1e I assume, so should the extra check also be dropped
> > here?
>
> I'm afraid I don't understand: I indeed mean to avoid adding a
> NULL check in get_page_from_l1e(). But what check are you thinking
> of that could be dropped? Or in other words, what is "here" in
> your reply?
Oh, I understand now, this is to prevent adding a check, not to remove
a check that's already in the code.
'here' meant the patch, since I wrongly assumed that this was to
remove a check that was already in the code base.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-17 9:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17 9:20 [PATCH] rangeset: make inquiry functions tolerate NULL inputs Jan Beulich
2018-08-17 9:29 ` Roger Pau Monné
2018-08-17 9:41 ` Jan Beulich
2018-08-17 9:55 ` Roger Pau Monné
2018-08-17 9:51 ` Wei Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.