All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [vireshk:virtio/msg-xen 3/23] drivers/firmware/arm_ffa/driver.c:1282:7-14: WARNING opportunity for kmemdup
Date: Fri, 17 Jan 2025 21:00:31 +0800	[thread overview]
Message-ID: <202501172022.oicUGCNf-lkp@intel.com> (raw)

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

                 reply	other threads:[~2025-01-17 13:00 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=202501172022.oicUGCNf-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=viresh.kumar@linaro.org \
    /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.