public inbox for chrome-platform@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Tzung-Bi Shih <tzungbi@kernel.org>, bleung@chromium.org
Cc: oe-kbuild-all@lists.linux.dev, tzungbi@kernel.org,
	dawidn@google.com, chrome-platform@lists.linux.dev,
	akpm@linux-foundation.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] platform/chrome: cros_ec_chardev: Consume cros_ec_device via ref_proxy
Date: Sat, 16 Aug 2025 19:46:15 +0800	[thread overview]
Message-ID: <202508161910.b7YHKLdh-lkp@intel.com> (raw)
In-Reply-To: <20250814091020.1302888-4-tzungbi@kernel.org>

Hi Tzung-Bi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on chrome-platform/for-next]
[also build test WARNING on next-20250815]
[cannot apply to chrome-platform/for-firmware-next akpm-mm/mm-nonmm-unstable akpm-mm/mm-everything linus/master v6.17-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tzung-Bi-Shih/lib-Add-ref_proxy-module/20250814-172126
base:   https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next
patch link:    https://lore.kernel.org/r/20250814091020.1302888-4-tzungbi%40kernel.org
patch subject: [PATCH 3/3] platform/chrome: cros_ec_chardev: Consume cros_ec_device via ref_proxy
config: i386-randconfig-061-20250815 (https://download.01.org/0day-ci/archive/20250816/202508161910.b7YHKLdh-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250816/202508161910.b7YHKLdh-lkp@intel.com/reproduce)

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/202508161910.b7YHKLdh-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/platform/chrome/cros_ec_chardev.c:75:47: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct cros_ec_device *ec_dev @@     got struct cros_ec_device [noderef] __rcu *[assigned] ec_dev @@
   drivers/platform/chrome/cros_ec_chardev.c:75:47: sparse:     expected struct cros_ec_device *ec_dev
   drivers/platform/chrome/cros_ec_chardev.c:75:47: sparse:     got struct cros_ec_device [noderef] __rcu *[assigned] ec_dev
>> drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got union ec_response_get_next_data_v3 [noderef] __rcu * @@
   drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse:     expected void const *
   drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse:     got union ec_response_get_next_data_v3 [noderef] __rcu *
>> drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got union ec_response_get_next_data_v3 [noderef] __rcu * @@
   drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse:     expected void const *
   drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse:     got union ec_response_get_next_data_v3 [noderef] __rcu *
   drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const * @@     got union ec_response_get_next_data_v3 [noderef] __rcu * @@
   drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse:     expected void const *
   drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse:     got union ec_response_get_next_data_v3 [noderef] __rcu *
>> drivers/platform/chrome/cros_ec_chardev.c:287:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct blocking_notifier_head *nh @@     got struct blocking_notifier_head [noderef] __rcu * @@
   drivers/platform/chrome/cros_ec_chardev.c:287:42: sparse:     expected struct blocking_notifier_head *nh
   drivers/platform/chrome/cros_ec_chardev.c:287:42: sparse:     got struct blocking_notifier_head [noderef] __rcu *
   drivers/platform/chrome/cros_ec_chardev.c:341:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct cros_ec_device *ec_dev @@     got struct cros_ec_device [noderef] __rcu *[assigned] ec_dev @@
   drivers/platform/chrome/cros_ec_chardev.c:341:40: sparse:     expected struct cros_ec_device *ec_dev
   drivers/platform/chrome/cros_ec_chardev.c:341:40: sparse:     got struct cros_ec_device [noderef] __rcu *[assigned] ec_dev
>> drivers/platform/chrome/cros_ec_chardev.c:374:43: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct cros_ec_device *ec @@     got struct cros_ec_device [noderef] __rcu *[assigned] ec_dev @@
   drivers/platform/chrome/cros_ec_chardev.c:374:43: sparse:     expected struct cros_ec_device *ec
   drivers/platform/chrome/cros_ec_chardev.c:374:43: sparse:     got struct cros_ec_device [noderef] __rcu *[assigned] ec_dev
>> drivers/platform/chrome/cros_ec_chardev.c:113:34: sparse: sparse: dereference of noderef expression
   drivers/platform/chrome/cros_ec_chardev.c:114:47: sparse: sparse: dereference of noderef expression
   drivers/platform/chrome/cros_ec_chardev.c:124:31: sparse: sparse: dereference of noderef expression
   drivers/platform/chrome/cros_ec_chardev.c:125:37: sparse: sparse: dereference of noderef expression
   drivers/platform/chrome/cros_ec_chardev.c:126:17: sparse: sparse: dereference of noderef expression
   drivers/platform/chrome/cros_ec_chardev.c:365:22: sparse: sparse: dereference of noderef expression
   drivers/platform/chrome/cros_ec_chardev.c:374:23: sparse: sparse: dereference of noderef expression

vim +75 drivers/platform/chrome/cros_ec_chardev.c

    51	
    52	static int ec_get_version(struct chardev_priv *priv, char *str, int maxlen)
    53	{
    54		static const char * const current_image_name[] = {
    55			"unknown", "read-only", "read-write", "invalid",
    56		};
    57		struct ec_response_get_version *resp;
    58		struct cros_ec_command *msg;
    59		struct cros_ec_device __rcu *ec_dev;
    60		int ret;
    61	
    62		msg = kzalloc(sizeof(*msg) + sizeof(*resp), GFP_KERNEL);
    63		if (!msg)
    64			return -ENOMEM;
    65	
    66		msg->command = EC_CMD_GET_VERSION + priv->cmd_offset;
    67		msg->insize = sizeof(*resp);
    68	
    69		REF_PROXY_GET(priv->ec_dev_proxy, ec_dev) {
    70			if (!ec_dev) {
    71				ret = -ENODEV;
    72				goto exit;
    73			}
    74	
  > 75			ret = cros_ec_cmd_xfer_status(ec_dev, msg);
    76			if (ret < 0) {
    77				snprintf(str, maxlen,
    78					 "Unknown EC version, returned error: %d\n",
    79					 msg->result);
    80				goto exit;
    81			}
    82		}
    83	
    84		resp = (struct ec_response_get_version *)msg->data;
    85		if (resp->current_image >= ARRAY_SIZE(current_image_name))
    86			resp->current_image = 3; /* invalid */
    87	
    88		snprintf(str, maxlen, "%s\n%s\n%s\n%s\n", CROS_EC_DEV_VERSION,
    89			 resp->version_string_ro, resp->version_string_rw,
    90			 current_image_name[resp->current_image]);
    91	
    92		ret = 0;
    93	exit:
    94		kfree(msg);
    95		return ret;
    96	}
    97	
    98	static int cros_ec_chardev_mkbp_event(struct notifier_block *nb,
    99					      unsigned long queued_during_suspend,
   100					      void *_notify)
   101	{
   102		struct chardev_priv *priv = container_of(nb, struct chardev_priv,
   103							 notifier);
   104		struct cros_ec_device __rcu *ec_dev;
   105		struct ec_event *event;
   106		unsigned long event_bit;
   107		int total_size;
   108	
   109		REF_PROXY_GET(priv->ec_dev_proxy, ec_dev) {
   110			if (!ec_dev)
   111				return NOTIFY_DONE;
   112	
 > 113			event_bit = 1 << ec_dev->event_data.event_type;
   114			total_size = sizeof(*event) + ec_dev->event_size;
   115	
   116			if (!(event_bit & priv->event_mask) ||
   117			    (priv->event_len + total_size) > CROS_MAX_EVENT_LEN)
   118				return NOTIFY_DONE;
   119	
   120			event = kzalloc(total_size, GFP_KERNEL);
   121			if (!event)
   122				return NOTIFY_DONE;
   123	
   124			event->size = ec_dev->event_size;
   125			event->event_type = ec_dev->event_data.event_type;
 > 126			memcpy(event->data, &ec_dev->event_data.data, ec_dev->event_size);
   127		}
   128	
   129		spin_lock(&priv->wait_event.lock);
   130		list_add_tail(&event->node, &priv->events);
   131		priv->event_len += total_size;
   132		wake_up_locked(&priv->wait_event);
   133		spin_unlock(&priv->wait_event.lock);
   134	
   135		return NOTIFY_OK;
   136	}
   137	

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

      parent reply	other threads:[~2025-08-16 11:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  9:10 [PATCH 0/3] platform/chrome: Fix a possible UAF via ref_proxy Tzung-Bi Shih
2025-08-14  9:10 ` [PATCH 1/3] lib: Add ref_proxy module Tzung-Bi Shih
2025-08-14 10:03   ` Greg KH
2025-08-15  5:35     ` Tzung-Bi Shih
2025-08-14 10:05   ` Greg KH
2025-08-14 10:27     ` Danilo Krummrich
2025-08-14 10:55   ` Danilo Krummrich
2025-08-15  5:36     ` Tzung-Bi Shih
2025-08-14  9:10 ` [PATCH 2/3] platform/chrome: Protect cros_ec_device lifecycle with ref_proxy Tzung-Bi Shih
2025-08-15 13:37   ` kernel test robot
2025-08-14  9:10 ` [PATCH 3/3] platform/chrome: cros_ec_chardev: Consume cros_ec_device via ref_proxy Tzung-Bi Shih
2025-08-15 21:06   ` kernel test robot
2025-08-16 11:46   ` kernel test robot [this message]

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=202508161910.b7YHKLdh-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dawidn@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=tzungbi@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox