From: Greg KH <gregkh@linuxfoundation.org>
To: Punit Vara <punitvara@gmail.com>
Cc: johnny.kim@atmel.com, rachel.kim@atmel.com, chris.park@atmel.com,
tony.cho@atmel.com, glen.lee@atmel.com, leo.kim@atmel.com,
linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] staging: wilc1000: Remove reference preceded by free
Date: Mon, 26 Oct 2015 04:12:49 +0900 [thread overview]
Message-ID: <20151025191249.GB23928@kroah.com> (raw)
In-Reply-To: <1445725885-25995-2-git-send-email-punitvara@gmail.com>
On Sun, Oct 25, 2015 at 04:01:23AM +0530, Punit Vara wrote:
> This patch is to the wilc_wfi_cfgoperations.c file that fixes up
> following error reported by coccicheck:
>
> ERROR: reference preceded by free on line 1219
>
> For (params->seq_len) <= 0 memory is already freed when
> (params->seq_len) >0 then memory was alloted. So there is no need to use
> kfree whenever params->seq_len <=0 remove it and place kfree inside
> (params->seq_len) >0 condition.
>
> Signed-off-by: Punit Vara <punitvara@gmail.com>
> ---
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> index bcbf1bd..9b3cf04 100644
> --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> @@ -1216,11 +1216,10 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
>
> priv->wilc_ptk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL);
>
> - kfree(priv->wilc_ptk[key_index]->seq);
> -
> - if ((params->seq_len) > 0)
> + if ((params->seq_len) > 0) {
> + kfree(priv->wilc_ptk[key_index]->seq);
> priv->wilc_ptk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL);
> -
> + }
Are you sure about this? It seems like you are changing the logic
here...
next prev parent reply other threads:[~2015-10-25 19:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-24 22:31 [PATCH 0/3] Staging: wilc1000: Remove coccicheck warnings and error Punit Vara
2015-10-24 22:31 ` [PATCH 1/3] staging: wilc1000: Remove reference preceded by free Punit Vara
2015-10-25 19:12 ` Greg KH [this message]
2015-10-25 19:31 ` punit vara
2015-10-25 19:59 ` punit vara
2015-10-25 21:32 ` Greg KH
2015-10-24 22:31 ` [PATCH 2/3] Staging: wilc1000: Remove comparision of field address to NULL Punit Vara
2015-10-25 19:12 ` Greg KH
2015-10-24 22:31 ` [PATCH 3/3] Staging: wilc1000: Remove boolean comparision Punit Vara
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=20151025191249.GB23928@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=chris.park@atmel.com \
--cc=devel@driverdev.osuosl.org \
--cc=glen.lee@atmel.com \
--cc=johnny.kim@atmel.com \
--cc=leo.kim@atmel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=punitvara@gmail.com \
--cc=rachel.kim@atmel.com \
--cc=tony.cho@atmel.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).