On Thu, Oct 23, 2025 at 05:44:12PM +0530, Sourabh Jain wrote:
> @@ -595,6 +602,13 @@ int get_crash_memory_ranges(struct crash_mem 
> **mem_ranges)
>       if (ret)
>               goto out;
>  
> +     for (i = 0; i < crashk_cma_cnt; ++i) {
> +             ret = crash_exclude_mem_range(tmem, crashk_cma_ranges[i].start,
> +                                           crashk_cma_ranges[i].end);
> +             if (ret)
> +                     goto out;
> +     }
> +

I think the loop needs to check if tmem->nr_ranges == tmem->max_nr_ranges and
reallocate in each iteration, just like it's done when excluding the crashk_res
region above:

        /* Reallocate memory ranges if there is no space to split ranges */
        tmem = *mem_ranges;
        if (tmem && (tmem->nr_ranges == tmem->max_nr_ranges)) {
                tmem = realloc_mem_ranges(mem_ranges);
                if (!tmem)
                        goto out;
        }

        /* Exclude crashkernel region */
        ret = crash_exclude_mem_range(tmem, crashk_res.start, crashk_res.end);
        if (ret)
                goto out;



-- 
Jiri Bohac <[email protected]>
SUSE Labs, Prague, Czechia


Reply via email to