All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Keith Busch <kbusch@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	Mike Christie <michael.christie@oracle.com>
Subject: kernel/vhost_task.c:148:9-16: WARNING: ERR_CAST can be used with tsk
Date: Tue, 11 Mar 2025 21:17:45 +0800	[thread overview]
Message-ID: <202503112124.LprWipYC-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4d872d51bc9d7b899c1f61534e3dbde72613f627
commit: cb380909ae3b1ebf14d6a455a4f92d7916d790cb vhost: return task creation error instead of NULL
date:   10 days ago
config: parisc-randconfig-r064-20250311 (https://download.01.org/0day-ci/archive/20250311/202503112124.LprWipYC-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 14.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/202503112124.LprWipYC-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> kernel/vhost_task.c:148:9-16: WARNING: ERR_CAST can be used with tsk

vim +148 kernel/vhost_task.c

   106	
   107	/**
   108	 * vhost_task_create - create a copy of a task to be used by the kernel
   109	 * @fn: vhost worker function
   110	 * @handle_sigkill: vhost function to handle when we are killed
   111	 * @arg: data to be passed to fn and handled_kill
   112	 * @name: the thread's name
   113	 *
   114	 * This returns a specialized task for use by the vhost layer or NULL on
   115	 * failure. The returned task is inactive, and the caller must fire it up
   116	 * through vhost_task_start().
   117	 */
   118	struct vhost_task *vhost_task_create(bool (*fn)(void *),
   119					     void (*handle_sigkill)(void *), void *arg,
   120					     const char *name)
   121	{
   122		struct kernel_clone_args args = {
   123			.flags		= CLONE_FS | CLONE_UNTRACED | CLONE_VM |
   124					  CLONE_THREAD | CLONE_SIGHAND,
   125			.exit_signal	= 0,
   126			.fn		= vhost_task_fn,
   127			.name		= name,
   128			.user_worker	= 1,
   129			.no_files	= 1,
   130		};
   131		struct vhost_task *vtsk;
   132		struct task_struct *tsk;
   133	
   134		vtsk = kzalloc(sizeof(*vtsk), GFP_KERNEL);
   135		if (!vtsk)
   136			return ERR_PTR(-ENOMEM);
   137		init_completion(&vtsk->exited);
   138		mutex_init(&vtsk->exit_mutex);
   139		vtsk->data = arg;
   140		vtsk->fn = fn;
   141		vtsk->handle_sigkill = handle_sigkill;
   142	
   143		args.fn_arg = vtsk;
   144	
   145		tsk = copy_process(NULL, 0, NUMA_NO_NODE, &args);
   146		if (IS_ERR(tsk)) {
   147			kfree(vtsk);
 > 148			return ERR_PTR(PTR_ERR(tsk));
   149		}
   150	
   151		vtsk->task = tsk;
   152		return vtsk;
   153	}
   154	EXPORT_SYMBOL_GPL(vhost_task_create);
   155	

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

                 reply	other threads:[~2025-03-11 13:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202503112124.LprWipYC-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.christie@oracle.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pbonzini@redhat.com \
    /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.