From: jassisinghbrar@gmail.com (Jassi Brar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] mailbox: mailbox-test: Use more consistent format for calling copy_from_user()
Date: Thu, 28 Jan 2016 09:54:16 +0530 [thread overview]
Message-ID: <CABb+yY3jG7XLf-+C5_pK_v7AoKYC2iskpL2=XpkvjPVZZcdCTQ@mail.gmail.com> (raw)
In-Reply-To: <1452755489-18736-2-git-send-email-lee.jones@linaro.org>
On Thu, Jan 14, 2016 at 12:41 PM, Lee Jones <lee.jones@linaro.org> wrote:
> While we're at it, ensure copy-to location is NULL'ed in the error path.
>
> Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
> drivers/mailbox/mailbox-test.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
> index 684ae17..7d9b915 100644
> --- a/drivers/mailbox/mailbox-test.c
> +++ b/drivers/mailbox/mailbox-test.c
> @@ -63,9 +63,9 @@ static ssize_t mbox_test_signal_write(struct file *filp,
> if (!tdev->signal)
> return -ENOMEM;
>
> - ret = copy_from_user(tdev->signal, userbuf, count);
> - if (ret) {
> + if (copy_from_user(tdev->signal, userbuf, count)) {
> kfree(tdev->signal);
> + tdev->signal = NULL;
> return -EFAULT;
> }
>
The function is left to return based on an uninitialized variable
('ret' on stack), so please merge this and the patch 2/4.
Thanks.
next prev parent reply other threads:[~2016-01-28 4:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 7:11 [PATCH 0/4] mailbox: A few fixes due for the v4.5-rc's Lee Jones
2016-01-14 7:11 ` [PATCH 1/4] mailbox: mailbox-test: Use more consistent format for calling copy_from_user() Lee Jones
2016-01-28 4:24 ` Jassi Brar [this message]
2016-01-14 7:11 ` [PATCH 2/4] mailbox: mailbox-test: Remove unused variable Lee Jones
2016-01-14 7:11 ` [PATCH 3/4] mailbox: mailbox-test: Prevent memory leak Lee Jones
2016-01-14 7:11 ` [PATCH 4/4] mailbox: Stop using ENOSYS for anything other than unimplemented syscalls Lee Jones
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='CABb+yY3jG7XLf-+C5_pK_v7AoKYC2iskpL2=XpkvjPVZZcdCTQ@mail.gmail.com' \
--to=jassisinghbrar@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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).