All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [openeuler:OLK-5.10 2818/2818] drivers/ub/urma/ubcore/ubcore_device.c:822 ubcore_config_device_in_register() warn: double check that we're allocating correct size: 20 vs 168
Date: Mon, 24 Mar 2025 18:39:43 +0800	[thread overview]
Message-ID: <202503241803.vldvrKSP-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: kernel@openeuler.org
TO: Yizhen Fan <fanyizhen@huawei.com>

tree:   https://gitee.com/openeuler/kernel.git OLK-5.10
head:   a7973281031cedabf6c66de13ffc2c313a71695f
commit: 84e122368ec3a37e074c9657bc09422b62f6ccd0 [2818/2818] ub: add new feature for urma
:::::: branch date: 3 days ago
:::::: commit date: 1 year, 4 months ago
config: x86_64-randconfig-161-20250322 (https://download.01.org/0day-ci/archive/20250324/202503241803.vldvrKSP-lkp@intel.com/config)
compiler: clang version 20.1.1 (https://github.com/llvm/llvm-project 424c2d9b7e4de40d0804dd374721e6411c27d1d1)

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202503241803.vldvrKSP-lkp@intel.com/

New smatch warnings:
drivers/ub/urma/ubcore/ubcore_device.c:822 ubcore_config_device_in_register() warn: double check that we're allocating correct size: 20 vs 168
drivers/ub/urma/ubcore/ubcore_tp.c:1124 ubcore_send_del_tp_req() warn: double check that we're allocating correct size: 20 vs 276
drivers/ub/urma/uburma/uburma_dev_ops.c:99 uburma_open() warn: this array is probably non-NULL. 'ubc_dev->dev_name'
drivers/ub/urma/ubcore/ubcore_msg.c:442 ubcore_msg_discover_eid() warn: double check that we're allocating correct size: 20 vs 160
drivers/ub/urma/uburma/uburma_event.c:381 uburma_get_async_event() warn: can 'event' even be NULL?
drivers/ub/urma/ubcore/ubcore_uvs_cmd.c:715 ubcore_copy_target_tpg_udrv_data() warn: maybe return -EFAULT instead of the bytes remaining?

Old smatch warnings:
drivers/ub/urma/ubcore/ubcore_tp.c:138 ubcore_set_tp_peer_ext() warn: maybe return -EFAULT instead of the bytes remaining?
drivers/ub/urma/ubcore/ubcore_tp.c:204 ubcore_nl_handle_create_tp_resp_cb() error: we previously assumed 'udata' could be null (see line 203)
drivers/ub/urma/ubcore/ubcore_tp.c:212 ubcore_nl_handle_create_tp_resp_cb() warn: maybe return -EFAULT instead of the bytes remaining?
drivers/ub/urma/ubcore/ubcore_msg.c:164 ubcore_tpf2fe_msg() error: dereferencing freed memory 's' (line 162)
drivers/ub/urma/ubcore/ubcore_cmd.h:136 ubcore_copy_to_user() warn: maybe return -EFAULT instead of the bytes remaining?
drivers/ub/urma/ubcore/ubcore_uvs_cmd.c:210 ubcore_copy_tpg_udrv_data() warn: maybe return -EFAULT instead of the bytes remaining?

vim +822 drivers/ub/urma/ubcore/ubcore_device.c

84e122368ec3a3 Yizhen Fan 2023-11-20  802  
84e122368ec3a3 Yizhen Fan 2023-11-20  803  static int ubcore_config_device_in_register(struct ubcore_device *dev)
84e122368ec3a3 Yizhen Fan 2023-11-20  804  {
84e122368ec3a3 Yizhen Fan 2023-11-20  805  	struct ubcore_msg_config_device_req *data;
84e122368ec3a3 Yizhen Fan 2023-11-20  806  	struct ubcore_msg *req_msg;
84e122368ec3a3 Yizhen Fan 2023-11-20  807  	struct ubcore_resp_cb cb = {
84e122368ec3a3 Yizhen Fan 2023-11-20  808  		.callback = ubcore_config_device_rsp_msg_cb,
84e122368ec3a3 Yizhen Fan 2023-11-20  809  		.user_arg = NULL
84e122368ec3a3 Yizhen Fan 2023-11-20  810  	};
84e122368ec3a3 Yizhen Fan 2023-11-20  811  	int ret;
84e122368ec3a3 Yizhen Fan 2023-11-20  812  
84e122368ec3a3 Yizhen Fan 2023-11-20  813  	if (dev->transport_type != UBCORE_TRANSPORT_UB)
84e122368ec3a3 Yizhen Fan 2023-11-20  814  		return 0;
84e122368ec3a3 Yizhen Fan 2023-11-20  815  
84e122368ec3a3 Yizhen Fan 2023-11-20  816  	if (ubcore_get_netlink_valid() == false) {
84e122368ec3a3 Yizhen Fan 2023-11-20  817  		ubcore_log_info("UVS is not connected, and use default config. dev: %s.\n",
84e122368ec3a3 Yizhen Fan 2023-11-20  818  			dev->dev_name);
84e122368ec3a3 Yizhen Fan 2023-11-20  819  		return ubcore_config_device_default(dev);
84e122368ec3a3 Yizhen Fan 2023-11-20  820  	}
84e122368ec3a3 Yizhen Fan 2023-11-20  821  
84e122368ec3a3 Yizhen Fan 2023-11-20 @822  	req_msg = kcalloc(1, sizeof(struct ubcore_msg) +
84e122368ec3a3 Yizhen Fan 2023-11-20  823  		sizeof(struct ubcore_msg_config_device_req), GFP_KERNEL);
84e122368ec3a3 Yizhen Fan 2023-11-20  824  	if (req_msg == NULL)
84e122368ec3a3 Yizhen Fan 2023-11-20  825  		return -ENOMEM;
84e122368ec3a3 Yizhen Fan 2023-11-20  826  
84e122368ec3a3 Yizhen Fan 2023-11-20  827  	req_msg->hdr.type = UBCORE_MSG_TYPE_FE2TPF;
84e122368ec3a3 Yizhen Fan 2023-11-20  828  	req_msg->hdr.opcode = UBCORE_MSG_CONFIG_DEVICE;
84e122368ec3a3 Yizhen Fan 2023-11-20  829  	req_msg->hdr.len = (uint32_t)sizeof(struct ubcore_msg_config_device_req);
84e122368ec3a3 Yizhen Fan 2023-11-20  830  
84e122368ec3a3 Yizhen Fan 2023-11-20  831  	data = (struct ubcore_msg_config_device_req *)req_msg->data;
84e122368ec3a3 Yizhen Fan 2023-11-20  832  	(void)memcpy(data->dev_name, dev->dev_name, UBCORE_MAX_DEV_NAME);
84e122368ec3a3 Yizhen Fan 2023-11-20  833  	data->max_rc_cnt = dev->attr.dev_cap.max_rc;
84e122368ec3a3 Yizhen Fan 2023-11-20  834  	data->max_rc_depth = dev->attr.dev_cap.max_rc_depth;
84e122368ec3a3 Yizhen Fan 2023-11-20  835  	data->min_slice = dev->attr.dev_cap.min_slice;
84e122368ec3a3 Yizhen Fan 2023-11-20  836  	data->max_slice = dev->attr.dev_cap.max_slice;
84e122368ec3a3 Yizhen Fan 2023-11-20  837  
84e122368ec3a3 Yizhen Fan 2023-11-20  838  	/* New TPF devices need to be query suspend info. */
84e122368ec3a3 Yizhen Fan 2023-11-20  839  	data->is_tpf_dev = dev->attr.tp_maintainer;
84e122368ec3a3 Yizhen Fan 2023-11-20  840  
84e122368ec3a3 Yizhen Fan 2023-11-20  841  	ret = ubcore_send_fe2tpf_msg(dev, req_msg, true, &cb);
84e122368ec3a3 Yizhen Fan 2023-11-20  842  	if (ret != 0) {
84e122368ec3a3 Yizhen Fan 2023-11-20  843  		ubcore_log_err("send fe2tpf failed.\n");
84e122368ec3a3 Yizhen Fan 2023-11-20  844  		return ubcore_config_device_default(dev);
84e122368ec3a3 Yizhen Fan 2023-11-20  845  	}
84e122368ec3a3 Yizhen Fan 2023-11-20  846  	return ret;
84e122368ec3a3 Yizhen Fan 2023-11-20  847  }
84e122368ec3a3 Yizhen Fan 2023-11-20  848  

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

                 reply	other threads:[~2025-03-24 10:40 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=202503241803.vldvrKSP-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@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 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.