From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: geoff@infradead.org, netdev@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org
Subject: Inconsistent use of size argument in kzalloc and memcpy in 'drivers/net/ethernet/toshiba/ps3_gelic_w
Date: Mon, 11 Apr 2016 10:00:04 +0000 [thread overview]
Message-ID: <570B75A4.5070904@wanadoo.fr> (raw)
Hi,
while looking at potential clean-up, I ended on the following code which
looks spurious to me.
We allocate 'be16_to_cpu(scan_info->size)' bytes, but then copy
'scan_info->size'.
This is not consistent.
I don't know which one is the correct one.
CJ
--- drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+++ /tmp/cocci-output-24201-0dddbd-ps3_gelic_wireless.c
@@ -1616,13 +1616,10 @@ static void gelic_wl_scan_complete_event
target->valid = 1;
target->eurus_index = i;
kfree(target->hwinfo);
- target->hwinfo = kzalloc(be16_to_cpu(scan_info->size),
- GFP_KERNEL);
if (!target->hwinfo)
continue;
/* copy hw scan info */
- memcpy(target->hwinfo, scan_info, scan_info->size);
target->essid_len = strnlen(scan_info->essid,
sizeof(scan_info->essid));
target->rate_len = 0;
next reply other threads:[~2016-04-11 10:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-11 10:00 Christophe JAILLET [this message]
2016-04-11 10:04 ` Inconsistent use of size argument in kzalloc and memcpy in 'drivers/net/ethernet/toshiba/ps3_gel walter harms
2016-04-11 10:26 ` Dan Carpenter
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=570B75A4.5070904@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=geoff@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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