> 
> I’ve just spotted an issue with the algorithm, the fix is this one:
> 
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index 24914a80d03b..262385a041a8 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -2360,6 +2360,10 @@ int __init 
> dt_merge_overlapping_addr_size_intervals(__be32 *reg, int *nr_cells,
>             __be32 *tmp_last_cell_size = last_cell + addrcells;
> 
>             dt_set_cell(&tmp_last_cell_size, sizecells, new_size);
> +
> +            /* Last interval updated, so the end is changed */
> +            end_last = start_last + size_last;
> +
>             /*
>              * This current interval is merged with the last one, so remove 
> this
>              * interval and shift left all the remaining elements
> 

Apologies, this is the fix:

diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 24914a80d03b..9a2f5b27aa9b 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -2360,6 +2360,10 @@ int __init 
dt_merge_overlapping_addr_size_intervals(__be32 *reg, int *nr_cells,
             __be32 *tmp_last_cell_size = last_cell + addrcells;
 
             dt_set_cell(&tmp_last_cell_size, sizecells, new_size);
+
+            /* Last interval updated, so the end is changed */
+            end_last = start_last + new_size;
+
             /*
              * This current interval is merged with the last one, so remove 
this
              * interval and shift left all the remaining elements

So instead of “size_last” -> “new_size”.

Sorry for the noise.

Cheers,
Luca

Reply via email to