[Skiboot] [PATCH 2/3] VAS: use local_free to free local_alloc memory

Stewart Smith stewart at flamingspork.com
Mon May 15 06:32:05 AEST 2023


> On May 13, 2023, at 04:31, Nicholas Piggin <npiggin at gmail.com> wrote:
> 
> free() asserts because local_alloc() doesn't allocate from the skiboot
> heap region. Fix this by using local_free().

Well, there’s something I probably didn’t catch in review a while ago :)

It may be possible to have valgrind pick up some of these in the unit tests too with some improved annotations and possible wrapping, as it can do warnings that the right kind of alloc/free was called. Although IIRC for *most* of the unit tests we end up not bringing in the skiboot allocator for ease of not going completely up the wall with looking too much like normal libc.

> 
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
> hw/vas.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/vas.c b/hw/vas.c
> index 96ca055c..aa3ae334 100644
> --- a/hw/vas.c
> +++ b/hw/vas.c
> @@ -428,7 +428,7 @@ static int init_uwcm(struct proc_chip *chip)
> static inline void free_wcbs(struct proc_chip *chip)
> {
> 	if (chip->vas->wcbs) {
> -		free((void *)chip->vas->wcbs);
> +		local_free((void *)chip->vas->wcbs);
> 		chip->vas->wcbs = 0ULL;
> 	}
> }
> @@ -466,7 +466,7 @@ static int alloc_init_wcbs(struct proc_chip *chip)
> 	return OPAL_SUCCESS;
> 
> out:
> -	free((void *)wcbs);
> +	local_free((void *)wcbs);
> 	return rc;
> }
> 
> -- 
> 2.40.1
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot



More information about the Skiboot mailing list