[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V2 01/10] arm/gic-v3: Fix bug in function cmp_rdist()



Hi Shanker,

On 26/06/16 18:48, Shanker Donthineni wrote:
The cmp_rdist() is always returning value zero irrespective of the
input Redistributor base addresses. Both the local variables 'l' and
'r' are pointing to the first argument 'a' causing the logical
expression 'l->base < r->base' always evaluated as false which is
wrong.

Signed-off-by: Shanker Donthineni <shankerd@xxxxxxxxxxxxxx>
---
  xen/arch/arm/gic-v3.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 8d3f149..b89c608 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1133,7 +1133,7 @@ static const hw_irq_controller gicv3_guest_irq_type = {

  static int __init cmp_rdist(const void *a, const void *b)
  {
-    const struct rdist_region *l = a, *r = a;
+    const struct rdist_region *l = a, *r = b;

Thank you for spotting the error. The sorting was required because of the way the vGIC emulated the re-distributors. However, this code has been reworked and sorted array is not necessary anymore.

So I would directly drop the sorting here.


      /* We assume that re-distributor regions can never overlap */
      return ( l->base < r->base) ? -1 : 0;


Regards,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.