linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Navid Emamdoost <navid.emamdoost@gmail.com>, devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	H Hartley Sweeten <hsweeten@visionengravers.com>,
	Ian Abbott <abbotti@mev.co.uk>,
	Navid Emamdoost <emamd001@umn.edu>
Subject: Re: [PATCH] staging: comedi: drivers: Fix memory leak in gsc_hpdi_auto_attach
Date: Sun, 15 Dec 2019 16:07:11 +0100	[thread overview]
Message-ID: <69f03714-c10e-8ff9-ae64-7b35b6a5fae9@web.de> (raw)
In-Reply-To: <20191215013306.18880-1-navid.emamdoost@gmail.com>

> 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

  reply	other threads:[~2019-12-15 15:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15  1:33 [PATCH] staging: comedi: drivers: Fix memory leak in gsc_hpdi_auto_attach Navid Emamdoost
2019-12-15 15:07 ` Markus Elfring [this message]
2019-12-16 10:36 ` Ian Abbott
2019-12-16 20:18   ` Navid Emamdoost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69f03714-c10e-8ff9-ae64-7b35b6a5fae9@web.de \
    --to=markus.elfring@web.de \
    --cc=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=emamd001@umn.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navid.emamdoost@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).