[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <69f03714-c10e-8ff9-ae64-7b35b6a5fae9@web.de>
Date: Sun, 15 Dec 2019 16:07:11 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Navid Emamdoost <navid.emamdoost@...il.com>,
devel@...verdev.osuosl.org
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
H Hartley Sweeten <hsweeten@...ionengravers.com>,
Ian Abbott <abbotti@....co.uk>,
Navid Emamdoost <emamd001@....edu>
Subject: Re: [PATCH] staging: comedi: drivers: Fix memory leak in
gsc_hpdi_auto_attach
> In the implementation of gsc_hpdi_auto_attach(), the allocated dma
> description is leaks in case of alignment error, …
Please avoid a typo in this change message.
…
+++ b/drivers/staging/comedi/drivers/gsc_hpdi.c
…
> @@ -660,6 +661,15 @@ static int gsc_hpdi_auto_attach(struct comedi_device *dev,
> s->cancel = gsc_hpdi_cancel;
>
> return gsc_hpdi_init(dev);
> +
> +release_dma_desc:
> + if (devpriv->dma_desc)
> + dma_free_coherent(&pcidev->dev,
> + sizeof(struct plx_dma_desc) *
> + NUM_DMA_DESCRIPTORS,
> + devpriv->dma_desc,
> + devpriv->dma_desc_phys_addr);
> + return retval;
> }
>
> static void gsc_hpdi_detach(struct comedi_device *dev)
I got the impression that return values from calls of the function “dma_alloc_coherent”
should be checked before.
* Would you like to add null pointer checks at other source code places?
* Should the jump targets be accordingly adjusted then for the completion
of the desired exception handling?
Regards,
Markus
Powered by blists - more mailing lists