From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Marek Belisko <marek.belisko@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Gulsah Kose <gulsah.1004@gmail.com>,
Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>,
Andrey Utkin <andrey.krieger.utkin@gmail.com>,
Monam Agarwal <monamagarwal123@gmail.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: ft1000: ft1000-usb: ft1000_hw.c: Fix a potential memory leak.
Date: Mon, 29 Dec 2014 12:16:39 +0530 [thread overview]
Message-ID: <20141229064639.GB3749@sudip-PC> (raw)
In-Reply-To: <1419705907-5937-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
On Sat, Dec 27, 2014 at 07:45:07PM +0100, Rickard Strandqvist wrote:
> Avoid allocate memory if we will exit the function.
>
> Was found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
> index 2e13e7b..72b8f03 100644
> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
> @@ -331,15 +331,15 @@ int card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer,
>
> DEBUG("card_send_command: enter card_send_command... size=%d\n", size);
this is not applying to next-20141226. your tree is not a current one. This DEBUG line was changed by patch "b5d8204d00fa3bcd1f3b4b060fb90675d00baee0"
thanks
sudip
>
> + ret = ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
> + if (ret)
> + return ret;
> +
> commandbuf = kmalloc(size + 2, GFP_KERNEL);
> if (!commandbuf)
> return -ENOMEM;
> memcpy((void *)commandbuf + 2, (void *)ptempbuffer, size);
>
> - ret = ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
> - if (ret)
> - return ret;
> -
> if (temp & 0x0100)
> usleep_range(900, 1100);
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
prev parent reply other threads:[~2014-12-29 6:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-27 18:45 Rickard Strandqvist
2014-12-29 6:46 ` Sudip Mukherjee [this message]
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=20141229064639.GB3749@sudip-PC \
--to=sudipm.mukherjee@gmail.com \
--cc=andrey.krieger.utkin@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=gulsah.1004@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marek.belisko@gmail.com \
--cc=monamagarwal123@gmail.com \
--cc=peter.p.waskiewicz.jr@intel.com \
--cc=rickard_strandqvist@spectrumdigital.se \
/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
all inboxes | Powered by JetHome®