All of lore.kernel.org
 help / color / mirror / Atom feed
* [vireshk:virtio/msg-xen 3/23] drivers/firmware/arm_ffa/driver.c:1282:7-14: WARNING opportunity for kmemdup
@ 2025-01-17 13:00 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-01-17 13:00 UTC (permalink / raw)
  To: Viresh Kumar; +Cc: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git virtio/msg-xen
head:   2e3356784e87f20c8375b12adebc1e706091c1c8
commit: c92b9202ffe8dca2c24ebc943f52ed20d4a8dafc [3/23] firmware: arm_ffa: Add support for framework notifications
config: arm64-randconfig-r053-20250117 (https://download.01.org/0day-ci/archive/20250117/202501172022.oicUGCNf-lkp@intel.com/config)
compiler: aarch64-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/202501172022.oicUGCNf-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/firmware/arm_ffa/driver.c:1282:7-14: WARNING opportunity for kmemdup

vim +1282 drivers/firmware/arm_ffa/driver.c

  1267	
  1268	static void handle_framework_notif_callbacks(u64 bitmap)
  1269	{
  1270		int notify_id = 0, recv_vm_id;
  1271		struct ffa_indirect_msg_hdr *msg, *buf;
  1272		struct notifier_cb_info *cb_info = NULL;
  1273	
  1274		/* Only one framework notification defined and supported */
  1275		if (!(bitmap & FRAMEWORK_NOTIFY_RX_BUFFER_FULL))
  1276			return;
  1277	
  1278		mutex_lock(&drv_info->rx_lock);
  1279	
  1280		msg = drv_info->rx_buffer;
  1281		recv_vm_id = RECEIVER_ID(msg->send_recv_id);
> 1282		buf = kmalloc(sizeof(*buf) + msg->size, GFP_KERNEL);
  1283		if (!buf) {
  1284			mutex_unlock(&drv_info->rx_lock);
  1285			return;
  1286		}
  1287		memcpy(buf, msg + msg->offset, sizeof(*buf) + msg->size);
  1288		buf->offset = sizeof(*buf);
  1289		mutex_unlock(&drv_info->rx_lock);
  1290	
  1291		ffa_rx_release();
  1292	
  1293		mutex_lock(&drv_info->notify_lock);
  1294		cb_info = notifier_hash_node_get(notify_id, recv_vm_id, true);
  1295		mutex_unlock(&drv_info->notify_lock);
  1296	
  1297		if (cb_info && cb_info->cb)
  1298			cb_info->cb(notify_id, buf);
  1299		kfree(buf);
  1300	}
  1301	

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

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

only message in thread, other threads:[~2025-01-17 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-17 13:00 [vireshk:virtio/msg-xen 3/23] drivers/firmware/arm_ffa/driver.c:1282:7-14: WARNING opportunity for kmemdup kernel test robot

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.