public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [linux-next:master 8334/9360] fs/btrfs/ioctl.c:4975:9-16: WARNING opportunity for kmemdup
       [not found] <202411050846.GI8oh5IK-lkp@intel.com>
@ 2024-11-11 14:38 ` David Sterba
  0 siblings, 0 replies; only message in thread
From: David Sterba @ 2024-11-11 14:38 UTC (permalink / raw)
  To: linux-btrfs
  Cc: Mark Harmstone, oe-kbuild-all, David Sterba, kernel test robot

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-11-11 14:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <202411050846.GI8oh5IK-lkp@intel.com>
2024-11-11 14:38 ` [linux-next:master 8334/9360] fs/btrfs/ioctl.c:4975:9-16: WARNING opportunity for kmemdup David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox