linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: fix ifnullfree.cocci warnings
  2016-11-28 17:42 [cryptodev:master 89/113] crypto/lrw.c:313:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values kbuild test robot
@ 2016-11-28 17:42 ` kbuild test robot
  2016-11-29  6:35   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2016-11-28 17:42 UTC (permalink / raw)
  To: Herbert Xu; +Cc: kbuild-all, linux-crypto

crypto/lrw.c:313:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 lrw.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -309,8 +309,7 @@ static void exit_crypt(struct skcipher_r
 
 	rctx->left = 0;
 
-	if (rctx->ext)
-		kfree(rctx->ext);
+	kfree(rctx->ext);
 }
 
 static int do_encrypt(struct skcipher_request *req, int err)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [cryptodev:master 89/113] crypto/lrw.c:313:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
@ 2016-11-28 17:42 kbuild test robot
  2016-11-28 17:42 ` [PATCH] crypto: fix ifnullfree.cocci warnings kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2016-11-28 17:42 UTC (permalink / raw)
  To: Herbert Xu; +Cc: kbuild-all, linux-crypto

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
head:   eb0955935e2ae3aa1fc9c34ec684ffe086e81da7
commit: 700cb3f5fe755b1a2d0f5cf3ae89ad7ef69d321f [89/113] crypto: lrw - Convert to skcipher


coccinelle warnings: (new ones prefixed by >>)

>> crypto/lrw.c:313:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: fix ifnullfree.cocci warnings
  2016-11-28 17:42 ` [PATCH] crypto: fix ifnullfree.cocci warnings kbuild test robot
@ 2016-11-29  6:35   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2016-11-29  6:35 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, linux-crypto

On Tue, Nov 29, 2016 at 01:42:38AM +0800, kbuild test robot wrote:
> crypto/lrw.c:313:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
> 
>  NULL check before some freeing functions is not needed.
> 
>  Based on checkpatch warning
>  "kfree(NULL) is safe this check is probably not required"
>  and kfreeaddr.cocci by Julia Lawall.
> 
> Generated by: scripts/coccinelle/free/ifnullfree.cocci
> 
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

Please keep it as it is.  This function is performance-critical
and the if clause does make a measurable difference.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-29  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-28 17:42 [cryptodev:master 89/113] crypto/lrw.c:313:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values kbuild test robot
2016-11-28 17:42 ` [PATCH] crypto: fix ifnullfree.cocci warnings kbuild test robot
2016-11-29  6:35   ` Herbert Xu

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).