Re: [PATCH] dma: qcom: gpi: Fix memory leak in gpi_peripheral_config()
From: Markus Elfring
Date: Wed Oct 29 2025 - 13:32:16 EST
…
> +++ b/drivers/dma/qcom/gpi.c
> @@ -1605,14 +1605,16 @@ static int
> gpi_peripheral_config(struct dma_chan *chan, struct dma_slave_config *config)
> {
…
> + new_config = krealloc(gchan->config, config->peripheral_size, GFP_NOWAIT);
> + if (!new_config)
> return -ENOMEM;
>
> + gchan->config = new_config;
> memcpy(gchan->config, config->peripheral_config, config->peripheral_size);
How do you think about to apply the following source code variant?
gchan->config = memcpy(new_config, config->peripheral_config, config->peripheral_size);
Regards,
Markus