From: walter harms <wharms@bfs.de>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
kernel-janitors@vger.kernel.org,
Andreas Dilger <andreas.dilger@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 19/20] staging: lustre: ptlrpc: sec_plain: remove unneeded null test before free
Date: Sat, 02 May 2015 09:14:39 +0000 [thread overview]
Message-ID: <5544957F.30009@bfs.de> (raw)
In-Reply-To: <1430509086-22132-3-git-send-email-Julia.Lawall@lip6.fr>
Am 01.05.2015 21:37, schrieb Julia Lawall:
> Kfree can cope with a null argument, so drop null tests.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@ expression ptr; @@
>
> - if (ptr != NULL)
> kfree(ptr);
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
> index 604e511..989cdcd 100644
> --- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
> +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
> @@ -384,8 +384,7 @@ struct ptlrpc_cli_ctx *plain_sec_install_ctx(struct plain_sec *plsec)
> if (ctx) {
> atomic_inc(&ctx->cc_refcount);
>
> - if (ctx_new)
> - kfree(ctx_new);
> + kfree(ctx_new);
> } else if (ctx_new) {
> ctx = ctx_new;
>
The error handling here is not obvious
the
OBD_ALLOC_PTR(ctx_new);
should have something like
if (!ctx_new)
return NULL;
just my 2 cents
re,
wh
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
kernel-janitors@vger.kernel.org,
Andreas Dilger <andreas.dilger@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 19/20] staging: lustre: ptlrpc: sec_plain: remove unneeded null test before free
Date: Sat, 02 May 2015 11:14:39 +0200 [thread overview]
Message-ID: <5544957F.30009@bfs.de> (raw)
In-Reply-To: <1430509086-22132-3-git-send-email-Julia.Lawall@lip6.fr>
Am 01.05.2015 21:37, schrieb Julia Lawall:
> Kfree can cope with a null argument, so drop null tests.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@ expression ptr; @@
>
> - if (ptr != NULL)
> kfree(ptr);
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
> index 604e511..989cdcd 100644
> --- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
> +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
> @@ -384,8 +384,7 @@ struct ptlrpc_cli_ctx *plain_sec_install_ctx(struct plain_sec *plsec)
> if (ctx) {
> atomic_inc(&ctx->cc_refcount);
>
> - if (ctx_new)
> - kfree(ctx_new);
> + kfree(ctx_new);
> } else if (ctx_new) {
> ctx = ctx_new;
>
The error handling here is not obvious
the
OBD_ALLOC_PTR(ctx_new);
should have something like
if (!ctx_new)
return NULL;
just my 2 cents
re,
wh
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-05-02 9:14 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 19:37 [PATCH 0/20] remove unneeded null test before free Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 20/20] staging: lustre: ptlrpc: service: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 19/20] staging: lustre: ptlrpc: sec_plain: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-02 9:14 ` walter harms [this message]
2015-05-02 9:14 ` walter harms
2015-05-01 19:37 ` [PATCH 18/20] Staging: lustre: ptlrpc: lproc_ptlrpc: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 17/20] Staging: lustre: osc: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 16/20] staging: lustre: obdecho: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 15/20] staging: lustre: obdclass: obd_mount: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 14/20] staging: lustre: obdclass: obd_config: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 13/20] staging: lustre: obdclass: llog: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 12/20] staging: lustre: obdclass: genops: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 11/20] staging: lustre: mdc: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 10/20] staging: lustre: lov: lov_dev: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 9/20] staging: lustre: lmv: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:37 ` [PATCH 8/20] staging: lustre: llite: statahead: " Julia Lawall
2015-05-01 19:37 ` Julia Lawall
2015-05-01 19:38 ` [PATCH 7/20] Staging: lustre: llite: llite_lib: " Julia Lawall
2015-05-01 19:38 ` Julia Lawall
2015-05-01 19:38 ` [PATCH 6/20] Staging: lustre: llite: file: " Julia Lawall
2015-05-01 19:38 ` Julia Lawall
2015-05-01 19:38 ` [PATCH 5/20] Staging: lustre: llite: dir: " Julia Lawall
2015-05-01 19:38 ` Julia Lawall
2015-05-01 19:38 ` [PATCH 4/20] staging: lustre: libcfs: linux: " Julia Lawall
2015-05-01 19:38 ` Julia Lawall
2015-05-01 19:38 ` [PATCH 3/20] staging: lustre: ldlm: ldlm_resource: " Julia Lawall
2015-05-01 19:38 ` Julia Lawall
2015-05-01 19:38 ` [PATCH 2/20] staging: lustre: ldlm: ldlm_lock: " Julia Lawall
2015-05-01 19:38 ` Julia Lawall
2015-05-01 19:38 ` [PATCH 1/20] staging: lustre: ldlm: ldlm_lib: " Julia Lawall
2015-05-01 19:38 ` Julia Lawall
2015-05-02 20:55 ` Dan Carpenter
2015-05-02 20:55 ` 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=5544957F.30009@bfs.de \
--to=wharms@bfs.de \
--cc=HPDD-discuss@ml01.01.org \
--cc=Julia.Lawall@lip6.fr \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg.drokin@intel.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.