From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: fs/verity/open.c:244:2: warning: Attempt to free released memory [clang-analyzer-unix.Malloc]
Date: Sun, 22 Aug 2021 11:00:48 +0800 [thread overview]
Message-ID: <202108221143.o9x2VtEr-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 13606 bytes --]
CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jakub Jelinek <jakub@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9ff50bf2f2ff5fab01cac26d8eed21a89308e6ef
commit: 2f78788b55baa3410b1ec91a576286abe1ad4d6a ilog2: improve ilog2 for constant arguments
date: 8 months ago
:::::: branch date: 9 hours ago
:::::: commit date: 8 months ago
config: arm-randconfig-c002-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2f78788b55baa3410b1ec91a576286abe1ad4d6a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 2f78788b55baa3410b1ec91a576286abe1ad4d6a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~
include/crypto/skcipher.h:499:2: note: Taking true branch
if (likely(req))
^
fs/crypto/keysetup_v1.c:63:8: note: Returned allocated memory
req = skcipher_request_alloc(tfm, GFP_KERNEL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/crypto/keysetup_v1.c:64:7: note: 'req' is non-null
if (!req) {
^~~
fs/crypto/keysetup_v1.c:64:2: note: Taking false branch
if (!req) {
^
fs/crypto/keysetup_v1.c:72:6: note: Assuming 'res' is < 0
if (res < 0)
^~~~~~~
fs/crypto/keysetup_v1.c:72:2: note: Taking true branch
if (res < 0)
^
fs/crypto/keysetup_v1.c:73:3: note: Control jumps to line 81
goto out;
^
fs/crypto/keysetup_v1.c:82:2: note: Potential leak of memory pointed to by 'req'
crypto_free_skcipher(tfm);
^
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
drivers/base/regmap/regmap-mmio.c:52:3: warning: Value stored to 'min_stride' is never read [clang-analyzer-deadcode.DeadStores]
min_stride = 0;
^ ~
drivers/base/regmap/regmap-mmio.c:52:3: note: Value stored to 'min_stride' is never read
min_stride = 0;
^ ~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
drivers/misc/eeprom/idt_89hpesx.c:977:3: warning: Value stored to 'csraddr_len' is never read [clang-analyzer-deadcode.DeadStores]
csraddr_len = strnlen(csraddr_str, count);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/eeprom/idt_89hpesx.c:977:3: note: Value stored to 'csraddr_len' is never read
csraddr_len = strnlen(csraddr_str, count);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 6 warnings (3 in non-user code, 3 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
>> fs/verity/open.c:244:2: warning: Attempt to free released memory [clang-analyzer-unix.Malloc]
kfree(vi->tree_params.hashstate);
^
fs/verity/open.c:306:6: note: Assuming the condition is false
if (!IS_VERITY(inode))
^~~~~~~~~~~~~~~~~
fs/verity/open.c:306:2: note: Taking false branch
if (!IS_VERITY(inode))
^
fs/verity/open.c:309:6: note: Assuming the condition is false
if (filp->f_mode & FMODE_WRITE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/verity/open.c:309:2: note: Taking false branch
if (filp->f_mode & FMODE_WRITE) {
^
fs/verity/open.c:315:9: note: Calling 'ensure_verity_info'
return ensure_verity_info(inode);
^~~~~~~~~~~~~~~~~~~~~~~~~
fs/verity/open.c:255:6: note: Assuming 'vi' is null
if (vi)
^~
fs/verity/open.c:255:2: note: Taking false branch
if (vi)
^
fs/verity/open.c:259:6: note: Assuming 'res' is >= 0
if (res < 0) {
^~~~~~~
fs/verity/open.c:259:2: note: Taking false branch
if (res < 0) {
^
fs/verity/open.c:264:6: note: Assuming 'res' is <= FS_VERITY_MAX_DESCRIPTOR_SIZE
if (res > FS_VERITY_MAX_DESCRIPTOR_SIZE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/verity/open.c:264:2: note: Taking false branch
if (res > FS_VERITY_MAX_DESCRIPTOR_SIZE) {
^
fs/verity/open.c:270:6: note: Assuming 'desc' is non-null
if (!desc)
^~~~~
fs/verity/open.c:270:2: note: Taking false branch
if (!desc)
^
fs/verity/open.c:273:6: note: Assuming 'res' is >= 0
if (res < 0) {
^~~~~~~
fs/verity/open.c:273:2: note: Taking false branch
if (res < 0) {
^
fs/verity/open.c:278:7: note: Calling 'fsverity_create_info'
vi = fsverity_create_info(inode, desc, res);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/verity/open.c:155:6: note: Assuming the condition is false
if (desc_size < sizeof(*desc)) {
^~~~~~~~~~~~~~~~~~~~~~~~~
fs/verity/open.c:155:2: note: Taking false branch
if (desc_size < sizeof(*desc)) {
^
fs/verity/open.c:161:6: note: Assuming field 'version' is equal to 1
if (desc->version != 1) {
^~~~~~~~~~~~~~~~~~
fs/verity/open.c:161:2: note: Taking false branch
if (desc->version != 1) {
^
fs/verity/open.c:167:6: note: Assuming the condition is false
if (memchr_inv(desc->__reserved, 0, sizeof(desc->__reserved))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/verity/open.c:167:2: note: Taking false branch
if (memchr_inv(desc->__reserved, 0, sizeof(desc->__reserved))) {
^
fs/verity/open.c:172:6: note: Assuming the condition is false
if (desc->salt_size > sizeof(desc->salt)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/verity/open.c:172:2: note: Taking false branch
if (desc->salt_size > sizeof(desc->salt)) {
^
fs/verity/open.c:177:6: note: Assuming field 'data_size' is equal to field 'i_size'
if (le64_to_cpu(desc->data_size) != inode->i_size) {
^
include/linux/byteorder/generic.h:87:21: note: expanded from macro 'le64_to_cpu'
#define le64_to_cpu __le64_to_cpu
^
include/uapi/linux/byteorder/little_endian.h:32:26: note: expanded from macro '__le64_to_cpu'
#define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
^
fs/verity/open.c:177:2: note: Taking false branch
if (le64_to_cpu(desc->data_size) != inode->i_size) {
^
fs/verity/open.c:185:6: note: Assuming 'vi' is non-null
if (!vi)
^~~
fs/verity/open.c:185:2: note: Taking false branch
if (!vi)
^
fs/verity/open.c:189:8: note: Calling 'fsverity_init_merkle_tree_params'
err = fsverity_init_merkle_tree_params(&vi->tree_params, inode,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/verity/open.c:43:2: note: Taking false branch
if (IS_ERR(hash_alg))
^
fs/verity/open.c:50:2: note: Taking false branch
if (IS_ERR(params->hashstate)) {
vim +244 fs/verity/open.c
fd2d1acfcadfe2 Eric Biggers 2019-07-22 239
fd2d1acfcadfe2 Eric Biggers 2019-07-22 240 void fsverity_free_info(struct fsverity_info *vi)
fd2d1acfcadfe2 Eric Biggers 2019-07-22 241 {
fd2d1acfcadfe2 Eric Biggers 2019-07-22 242 if (!vi)
fd2d1acfcadfe2 Eric Biggers 2019-07-22 243 return;
fd2d1acfcadfe2 Eric Biggers 2019-07-22 @244 kfree(vi->tree_params.hashstate);
fd2d1acfcadfe2 Eric Biggers 2019-07-22 245 kmem_cache_free(fsverity_info_cachep, vi);
fd2d1acfcadfe2 Eric Biggers 2019-07-22 246 }
fd2d1acfcadfe2 Eric Biggers 2019-07-22 247
:::::: The code at line 244 was first introduced by commit
:::::: fd2d1acfcadfe2e42567afaec5e989b38061a7d2 fs-verity: add the hook for file ->open()
:::::: TO: Eric Biggers <ebiggers@google.com>
:::::: CC: Eric Biggers <ebiggers@google.com>
---
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: 27070 bytes --]
next reply other threads:[~2021-08-22 3:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-22 3:00 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-08-17 21:15 fs/verity/open.c:244:2: warning: Attempt to free released memory [clang-analyzer-unix.Malloc] kernel test robot
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=202108221143.o9x2VtEr-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/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.