All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: fs/bcachefs/compress.c:34 __bounce_alloc() warn: possible memory leak of 'b'
Date: Sat, 4 Nov 2023 04:46:14 +0800	[thread overview]
Message-ID: <202311040441.HuERUoCH-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Kent Overstreet <kmo@daterainc.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8f6f76a6a29f36d2f3e4510d0bde5046672f6924
commit: 1c6fdbd8f2465ddfb73a01ec620cbf3d14044e1a bcachefs: Initial commit
date:   12 days ago
:::::: branch date: 14 hours ago
:::::: commit date: 12 days ago
config: x86_64-randconfig-161-20231102 (https://download.01.org/0day-ci/archive/20231104/202311040441.HuERUoCH-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce: (https://download.01.org/0day-ci/archive/20231104/202311040441.HuERUoCH-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202311040441.HuERUoCH-lkp@intel.com/

smatch warnings:
fs/bcachefs/compress.c:34 __bounce_alloc() warn: possible memory leak of 'b'

vim +/b +34 fs/bcachefs/compress.c

1c6fdbd8f2465d Kent Overstreet 2017-03-16  25  
1c6fdbd8f2465d Kent Overstreet 2017-03-16  26  static struct bbuf __bounce_alloc(struct bch_fs *c, unsigned size, int rw)
1c6fdbd8f2465d Kent Overstreet 2017-03-16  27  {
1c6fdbd8f2465d Kent Overstreet 2017-03-16  28  	void *b;
1c6fdbd8f2465d Kent Overstreet 2017-03-16  29  
1c6fdbd8f2465d Kent Overstreet 2017-03-16  30  	BUG_ON(size > c->sb.encoded_extent_max << 9);
1c6fdbd8f2465d Kent Overstreet 2017-03-16  31  
1c6fdbd8f2465d Kent Overstreet 2017-03-16  32  	b = kmalloc(size, GFP_NOIO|__GFP_NOWARN);
1c6fdbd8f2465d Kent Overstreet 2017-03-16  33  	if (b)
1c6fdbd8f2465d Kent Overstreet 2017-03-16 @34  		return (struct bbuf) { .b = b, .type = BB_KMALLOC, .rw = rw };
1c6fdbd8f2465d Kent Overstreet 2017-03-16  35  
1c6fdbd8f2465d Kent Overstreet 2017-03-16  36  	b = mempool_alloc(&c->compression_bounce[rw], GFP_NOWAIT);
1c6fdbd8f2465d Kent Overstreet 2017-03-16  37  	b = b ? page_address(b) : NULL;
1c6fdbd8f2465d Kent Overstreet 2017-03-16  38  	if (b)
1c6fdbd8f2465d Kent Overstreet 2017-03-16  39  		return (struct bbuf) { .b = b, .type = BB_MEMPOOL, .rw = rw };
1c6fdbd8f2465d Kent Overstreet 2017-03-16  40  
1c6fdbd8f2465d Kent Overstreet 2017-03-16  41  	b = vmalloc(size);
1c6fdbd8f2465d Kent Overstreet 2017-03-16  42  	if (b)
1c6fdbd8f2465d Kent Overstreet 2017-03-16  43  		return (struct bbuf) { .b = b, .type = BB_VMALLOC, .rw = rw };
1c6fdbd8f2465d Kent Overstreet 2017-03-16  44  
1c6fdbd8f2465d Kent Overstreet 2017-03-16  45  	b = mempool_alloc(&c->compression_bounce[rw], GFP_NOIO);
1c6fdbd8f2465d Kent Overstreet 2017-03-16  46  	b = b ? page_address(b) : NULL;
1c6fdbd8f2465d Kent Overstreet 2017-03-16  47  	if (b)
1c6fdbd8f2465d Kent Overstreet 2017-03-16  48  		return (struct bbuf) { .b = b, .type = BB_MEMPOOL, .rw = rw };
1c6fdbd8f2465d Kent Overstreet 2017-03-16  49  
1c6fdbd8f2465d Kent Overstreet 2017-03-16  50  	BUG();
1c6fdbd8f2465d Kent Overstreet 2017-03-16  51  }
1c6fdbd8f2465d Kent Overstreet 2017-03-16  52  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2023-11-03 20:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 20:46 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-11-05  3:16 fs/bcachefs/compress.c:34 __bounce_alloc() warn: possible memory leak of 'b' kernel test robot
2023-11-02 19:47 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=202311040441.HuERUoCH-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.