From: Joe Perches <joe@perches.com>
To: Bing Zhao <bzhao@marvell.com>
Cc: linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>,
Amitkumar Karwar <akarwar@marvell.com>,
Kiran Divekar <dkiran@marvell.com>,
Yogesh Powar <yogeshp@marvell.com>,
Frank Huang <frankh@marvell.com>, Walter Harms <wharms@bfs.de>
Subject: Re: [PATCH v2] mwifiex: replace kmalloc & memcpy sequence with kmemdup
Date: Thu, 25 Aug 2011 16:45:08 -0700 [thread overview]
Message-ID: <1314315908.4637.23.camel@Joe-Laptop> (raw)
In-Reply-To: <1314301042-15021-1-git-send-email-bzhao@marvell.com>
On Thu, 2011-08-25 at 12:37 -0700, Bing Zhao wrote:
> Sequence of kmalloc/kzalloc and memcpy is replaced with
> kmemdup.
> diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
[]
> @@ -1986,17 +1986,20 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
> priv->curr_bcn_size = curr_bss->beacon_buf_size;
>
> kfree(priv->curr_bcn_buf);
> - priv->curr_bcn_buf = kzalloc(curr_bss->beacon_buf_size,
> +
> + priv->curr_bcn_buf = kmemdup(curr_bss->beacon_buf,
> + curr_bss->beacon_buf_size,
> GFP_KERNEL);
I think this block, because of the new else below it,
isn't an improvement.
This kfree/kzalloc should probably just be krealloc with
the memset unchanged.
> if (!priv->curr_bcn_buf) {
> dev_err(priv->adapter->dev,
> "failed to alloc curr_bcn_buf\n");
> return;
> }
> + } else {
> + memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf,
> + curr_bss->beacon_buf_size);
> }
>
> - memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf,
> - curr_bss->beacon_buf_size);
> dev_dbg(priv->adapter->dev, "info: current beacon saved %d\n",
> priv->curr_bcn_size);
next prev parent reply other threads:[~2011-08-25 23:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 19:37 [PATCH v2] mwifiex: replace kmalloc & memcpy sequence with kmemdup Bing Zhao
2011-08-25 23:45 ` Joe Perches [this message]
2011-08-29 19:25 ` Bing Zhao
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=1314315908.4637.23.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=akarwar@marvell.com \
--cc=bzhao@marvell.com \
--cc=dkiran@marvell.com \
--cc=frankh@marvell.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=wharms@bfs.de \
--cc=yogeshp@marvell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox