From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Christian Engelmayer <cengelma@gmx.at>
Cc: linux-input@vger.kernel.org, andrew.smirnov@gmail.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: ims-pcu - fix uninitialized use of 'error' in ims_pcu_buffers_alloc()
Date: Sun, 18 May 2014 16:00:58 -0700 [thread overview]
Message-ID: <20140518230058.GA27053@core.coreip.homeip.net> (raw)
In-Reply-To: <1400449278-14513-1-git-send-email-cengelma@gmx.at>
On Sun, May 18, 2014 at 11:41:18PM +0200, Christian Engelmayer wrote:
> In case allocation via usb_alloc_coherent() fails in ims_pcu_buffers_alloc(),
> the function jumps to the exit path without initializing local variable
> 'error' that is used as return value. Detected by Coverity - CID 1016531.
>
> Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Applied, thank you.
> ---
> This is an allocation function and all currently coded error scenarios
> result in -ENOMEM. Thus it would be possible to eliminate 'error' at all and
> always return -ENOMEM in the error path.
>
> Compile tested. Applies against branch next in tree
> git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
> ---
> drivers/input/misc/ims-pcu.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
> index 5a73639..719410f 100644
> --- a/drivers/input/misc/ims-pcu.c
> +++ b/drivers/input/misc/ims-pcu.c
> @@ -1566,6 +1566,7 @@ static int ims_pcu_buffers_alloc(struct ims_pcu *pcu)
> if (!pcu->urb_ctrl_buf) {
> dev_err(pcu->dev,
> "Failed to allocate memory for read buffer\n");
> + error = -ENOMEM;
> goto err_free_urb_out_buf;
> }
>
> --
> 1.9.1
>
--
Dmitry
prev parent reply other threads:[~2014-05-18 23:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-18 21:41 [PATCH] Input: ims-pcu - fix uninitialized use of 'error' in ims_pcu_buffers_alloc() Christian Engelmayer
2014-05-18 23:00 ` Dmitry Torokhov [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=20140518230058.GA27053@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=andrew.smirnov@gmail.com \
--cc=cengelma@gmx.at \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).