All of lore.kernel.org
 help / color / mirror / Atom feed
* security/keys/big_key.c:125:12-13: WARNING: opportunity for kzfree/kvfree_sensitive
@ 2020-09-08 18:40 kernel test robot
  2020-09-08 18:40 ` [PATCH] coccinelle: api: fix kzfree.cocci warnings kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2020-09-08 18:40 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@lip6.fr>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f4d51dffc6c01a9e94650d95ce0104964f8ae822
commit: 7cf4be68b177855b620dbc045bf26606eed197ac coccinelle: api: add kzfree script
date:   5 weeks ago
:::::: branch date: 2 days ago
:::::: commit date: 5 weeks ago
config: arm64-randconfig-c004-20200904 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


coccinelle warnings: (new ones prefixed by >>)

>> security/keys/big_key.c:125:12-13: WARNING: opportunity for kzfree/kvfree_sensitive
   security/keys/big_key.c:144:11-12: WARNING: opportunity for kzfree/kvfree_sensitive
   security/keys/big_key.c:277:12-13: WARNING: opportunity for kzfree/kvfree_sensitive

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34228 bytes --]

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

* [PATCH] coccinelle: api: fix kzfree.cocci warnings
  2020-09-08 18:40 security/keys/big_key.c:125:12-13: WARNING: opportunity for kzfree/kvfree_sensitive kernel test robot
@ 2020-09-08 18:40 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-09-08 18:40 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2312 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@lip6.fr>
CC: David Howells <dhowells@redhat.com>
CC: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
CC: James Morris <jmorris@namei.org>
CC: "Serge E. Hallyn" <serge@hallyn.com>
CC: keyrings(a)vger.kernel.org
CC: linux-security-module(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

security/keys/big_key.c:125:12-13: WARNING: opportunity for kzfree/kvfree_sensitive
security/keys/big_key.c:144:11-12: WARNING: opportunity for kzfree/kvfree_sensitive
security/keys/big_key.c:277:12-13: WARNING: opportunity for kzfree/kvfree_sensitive


 Use kzfree, kvfree_sensitive rather than memset or
 memzero_explicit followed by kfree

Generated by: scripts/coccinelle/api/kzfree.cocci

Fixes: 7cf4be68b177 ("coccinelle: api: add kzfree script")
CC: Denis Efremov <efremov@linux.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f4d51dffc6c01a9e94650d95ce0104964f8ae822
commit: 7cf4be68b177855b620dbc045bf26606eed197ac coccinelle: api: add kzfree script
:::::: branch date: 2 days ago
:::::: commit date: 5 weeks ago

Please take the patch only if it's a positive warning. Thanks!

 big_key.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

--- a/security/keys/big_key.c
+++ b/security/keys/big_key.c
@@ -121,8 +121,7 @@ int big_key_preparse(struct key_preparse
 		*path = file->f_path;
 		path_get(path);
 		fput(file);
-		memzero_explicit(buf, enclen);
-		kvfree(buf);
+		kvfree_sensitive(buf, enclen);
 	} else {
 		/* Just store the data in a buffer */
 		void *data = kmalloc(datalen, GFP_KERNEL);
@@ -140,8 +139,7 @@ err_fput:
 err_enckey:
 	kfree_sensitive(enckey);
 error:
-	memzero_explicit(buf, enclen);
-	kvfree(buf);
+	kvfree_sensitive(buf, enclen);
 	return ret;
 }
 
@@ -273,8 +271,7 @@ long big_key_read(const struct key *key,
 err_fput:
 		fput(file);
 error:
-		memzero_explicit(buf, enclen);
-		kvfree(buf);
+		kvfree_sensitive(buf, enclen);
 	} else {
 		ret = datalen;
 		memcpy(buffer, key->payload.data[big_key_data], datalen);

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

end of thread, other threads:[~2020-09-08 18:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 18:40 security/keys/big_key.c:125:12-13: WARNING: opportunity for kzfree/kvfree_sensitive kernel test robot
2020-09-08 18:40 ` [PATCH] coccinelle: api: fix kzfree.cocci warnings kernel test robot

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.