public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: linux-btrfs@vger.kernel.org
Cc: Mark Harmstone <maharmstone@fb.com>,
	oe-kbuild-all@lists.linux.dev, David Sterba <dsterba@suse.com>,
	kernel test robot <lkp@intel.com>
Subject: Re: [linux-next:master 8334/9360] fs/btrfs/ioctl.c:4975:9-16: WARNING opportunity for kmemdup
Date: Mon, 11 Nov 2024 15:38:04 +0100	[thread overview]
Message-ID: <20241111143804.GP31418@suse.cz> (raw)
In-Reply-To: <202411050846.GI8oh5IK-lkp@intel.com>

On Tue, Nov 05, 2024 at 08:05:14AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   1ffec08567f426a1c593e038cadc61bdc38cb467
> commit: 48b8a3df6d216bf9641bebf1efa1a3e1bdc9520d [8334/9360] btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)
> config: x86_64-randconfig-103-20241104 (https://download.01.org/0day-ci/archive/20241105/202411050846.GI8oh5IK-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> 
> 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>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202411050846.GI8oh5IK-lkp@intel.com/
> 
> cocci warnings: (new ones prefixed by >>)
> >> fs/btrfs/ioctl.c:4975:9-16: WARNING opportunity for kmemdup
> 
> vim +4975 fs/btrfs/ioctl.c
> 
>   4869	static int btrfs_uring_encoded_read(struct io_uring_cmd *cmd, unsigned int issue_flags)
>   4870	{

>   4970			/*
>   4971			 * If we've optimized things by storing the iovecs on the stack,
>   4972			 * undo this.
>   4973			 */
>   4974			if (!iov) {
> > 4975				iov = kmalloc(sizeof(struct iovec) * args.iovcnt, GFP_NOFS);
>   4976				if (!iov) {
>   4977					unlock_extent(io_tree, start, lockend, &cached_state);
>   4978					btrfs_inode_unlock(inode, BTRFS_ILOCK_SHARED);
>   4979					ret = -ENOMEM;
>   4980					goto out_acct;
>   4981				}
>   4982	
>   4983				memcpy(iov, iovstack, sizeof(struct iovec) * args.iovcnt);

Yeah, easy patch if anybody wants to send it.

           reply	other threads:[~2024-11-11 14:38 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <202411050846.GI8oh5IK-lkp@intel.com>]

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=20241111143804.GP31418@suse.cz \
    --to=dsterba@suse.cz \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=maharmstone@fb.com \
    --cc=oe-kbuild-all@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox