From: walter harms <wharms@bfs.de>
To: Dan Carpenter <error27@gmail.com>
Cc: Scott Feldman <scofeldm@cisco.com>,
Vasanthy Kolluri <vkolluri@cisco.com>,
Roopa Prabhu <roprabhu@cisco.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] enic: cleanup vic_provinfo_alloc()
Date: Thu, 10 Jun 2010 11:22:49 +0200 [thread overview]
Message-ID: <4C10AEE9.4090804@bfs.de> (raw)
In-Reply-To: <20100610075903.GL5483@bicker>
Dan Carpenter schrieb:
> If oui were a null variable then vic_provinfo_alloc() would leak memory.
> But this function is only called from one place and oui is not null so
> I removed the check.
>
> I also moved the memory allocation down a line so it was easier to spot.
> (No one ever reads variable declarations).
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/net/enic/vnic_vic.c b/drivers/net/enic/vnic_vic.c
> index d769772..0a35085 100644
> --- a/drivers/net/enic/vnic_vic.c
> +++ b/drivers/net/enic/vnic_vic.c
> @@ -25,9 +25,10 @@
>
> struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type)
> {
> - struct vic_provinfo *vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags);
> + struct vic_provinfo *vp;
>
> - if (!vp || !oui)
> + vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags);
> + if (!vp)
> return NULL;
>
> memcpy(vp->oui, oui, sizeof(vp->oui));
> --
This looks like memdup() ?
re,
wh
next prev parent reply other threads:[~2010-06-10 9:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 7:59 [patch] enic: cleanup vic_provinfo_alloc() Dan Carpenter
2010-06-10 9:22 ` walter harms [this message]
2010-06-10 9:32 ` Dan Carpenter
2010-06-12 0:05 ` Scott Feldman
2010-06-12 1:37 ` David Miller
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=4C10AEE9.4090804@bfs.de \
--to=wharms@bfs.de \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roprabhu@cisco.com \
--cc=scofeldm@cisco.com \
--cc=vkolluri@cisco.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;
as well as URLs for NNTP newsgroup(s).