From: Greg KH <gregkh@linuxfoundation.org>
To: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH v2] Staging: rtl8192u: Do not DMA on the stack
Date: Thu, 8 Oct 2015 10:45:36 +0100 [thread overview]
Message-ID: <20151008094536.GC6793@kroah.com> (raw)
In-Reply-To: <1444158431-4229-1-git-send-email-ksenija.stanojevic@gmail.com>
On Tue, Oct 06, 2015 at 09:07:11PM +0200, Ksenija Stanojevic wrote:
> Fix error "doing DMA on the stack" by using kzalloc for buffer
> allocation.
> Issue found by smatch.
>
> Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
> ---
> Changes in v2:
> -put all changes in one patch instead patchset.
> -replace &data with pdata
>
> drivers/staging/rtl8192u/r8192U_core.c | 72 +++++++++++++++++++++++++++++-----
> 1 file changed, 63 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index 28b54ba..cf6f90d 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -259,10 +259,16 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
> int status;
> struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
> struct usb_device *udev = priv->udev;
> + u8 *pdata = kzalloc(sizeof(data), GFP_KERNEL);
Ok, I'm going to be "pendantic" here and say you should never put a 'p'
in front of a variable name just because it is a "pointer". We know
it's a pointer, the compiler tells us that, so you can't get it wrong.
Try naming it what it is, "usbdata" or "msgdata" or something like that.
Naming is hard, sorry, but please don't try to use 'hungarian notation'
for naming variables, that's just not needed at all in Linux, and is
considered bad-form.
thansk,
greg k-h
prev parent reply other threads:[~2015-10-08 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 19:07 [PATCH v2] Staging: rtl8192u: Do not DMA on the stack Ksenija Stanojevic
2015-10-06 19:25 ` [Outreachy kernel] " Arnd Bergmann
2015-10-08 9:43 ` Greg KH
2015-10-08 9:45 ` Greg KH [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=20151008094536.GC6793@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=ksenija.stanojevic@gmail.com \
--cc=outreachy-kernel@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.