From: David Miller <davem@davemloft.net>
To: falakreyaz@gmail.com
Cc: kas@fi.muni.cz, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wan: cosa: use memdup_user().
Date: Mon, 23 May 2016 14:02:32 -0700 (PDT) [thread overview]
Message-ID: <20160523.140232.31037641382794779.davem@davemloft.net> (raw)
In-Reply-To: <1463746806-23739-1-git-send-email-falakreyaz@gmail.com>
From: Muhammad Falak R Wani <falakreyaz@gmail.com>
Date: Fri, 20 May 2016 17:50:06 +0530
> Use memdup_user to duplicate a memory region from user-space to
> kernel-space, instead of open coding using kmalloc & copy_from_user.
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
> ---
> drivers/net/wan/cosa.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
> index b87fe0a..fb37439 100644
> --- a/drivers/net/wan/cosa.c
> +++ b/drivers/net/wan/cosa.c
> @@ -876,15 +876,10 @@ static ssize_t cosa_write(struct file *file,
> count = COSA_MTU;
>
> /* Allocate the buffer */
> - kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA);
> - if (kbuf == NULL) {
> + kbuf = memdup_user(buf, count);
You're losing the GFP_DMA specification here, therefore this change
is not correct.
prev parent reply other threads:[~2016-05-23 21:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-20 12:20 [PATCH] wan: cosa: use memdup_user() Muhammad Falak R Wani
2016-05-23 21:02 ` David Miller [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=20160523.140232.31037641382794779.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=falakreyaz@gmail.com \
--cc=kas@fi.muni.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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).