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: [axboe:rw_iter 155/471] drivers/usb/chipidea/debug.c:89 ci_port_test_write() warn: potential spectre issue 'buf' [w]
Date: Thu, 12 Mar 2026 15:46:16 +0800	[thread overview]
Message-ID: <202603121510.vaiHWvfx-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Jens Axboe <axboe@kernel.dk>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git rw_iter
head:   0a49759be1c3b29207758e467fdc1a90d0716d06
commit: c08703a0ede98e3db453b782579c22892e8909ab [155/471] usb: chipidea: convert to read/write iterators
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: openrisc-randconfig-r071-20260307 (https://download.01.org/0day-ci/archive/20260312/202603121510.vaiHWvfx-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 15.2.0
smatch: v0.5.0-9004-gb810ac53

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/202603121510.vaiHWvfx-lkp@intel.com/

smatch warnings:
drivers/usb/chipidea/debug.c:89 ci_port_test_write() warn: potential spectre issue 'buf' [w]

vim +/buf +89 drivers/usb/chipidea/debug.c

e443b333629f82c Alexander Shishkin  2012-05-11   70  
5722a8efc6c8979 Lee Jones           2020-07-03   71  /*
2d6512892c10655 Alexander Shishkin  2013-03-30   72   * ci_port_test_write: writes port test mode
e443b333629f82c Alexander Shishkin  2012-05-11   73   */
c08703a0ede98e3 Jens Axboe          2024-04-11   74  static ssize_t ci_port_test_write(struct kiocb *iocb, struct iov_iter *from)
e443b333629f82c Alexander Shishkin  2012-05-11   75  {
c08703a0ede98e3 Jens Axboe          2024-04-11   76  	struct seq_file *s = iocb->ki_filp->private_data;
c08703a0ede98e3 Jens Axboe          2024-04-11   77  	size_t count = iov_iter_count(from);
8e22978c57087aa Alexander Shishkin  2013-06-24   78  	struct ci_hdrc *ci = s->private;
e443b333629f82c Alexander Shishkin  2012-05-11   79  	unsigned long flags;
e443b333629f82c Alexander Shishkin  2012-05-11   80  	unsigned mode;
2d6512892c10655 Alexander Shishkin  2013-03-30   81  	char buf[32];
2d6512892c10655 Alexander Shishkin  2013-03-30   82  	int ret;
e443b333629f82c Alexander Shishkin  2012-05-11   83  
bd5fb0aec3dd7cd Heinrich Schuchardt 2015-04-28   84  	count = min_t(size_t, sizeof(buf) - 1, count);
c08703a0ede98e3 Jens Axboe          2024-04-11   85  	if (!copy_from_iter_full(buf, count, from))
2d6512892c10655 Alexander Shishkin  2013-03-30   86  		return -EFAULT;
e443b333629f82c Alexander Shishkin  2012-05-11   87  
bd5fb0aec3dd7cd Heinrich Schuchardt 2015-04-28   88  	/* sscanf requires a zero terminated string */
bd5fb0aec3dd7cd Heinrich Schuchardt 2015-04-28  @89  	buf[count] = '\0';
bd5fb0aec3dd7cd Heinrich Schuchardt 2015-04-28   90  
2d6512892c10655 Alexander Shishkin  2013-03-30   91  	if (sscanf(buf, "%u", &mode) != 1)
2d6512892c10655 Alexander Shishkin  2013-03-30   92  		return -EINVAL;
e443b333629f82c Alexander Shishkin  2012-05-11   93  
3c724888d2b1e08 Alan                2016-02-15   94  	if (mode > 255)
3c724888d2b1e08 Alan                2016-02-15   95  		return -EBADRQC;
3c724888d2b1e08 Alan                2016-02-15   96  
bc24937943d9f71 Li Jun              2015-07-29   97  	pm_runtime_get_sync(ci->dev);
26c696c678c4ce1 Richard Zhao        2012-07-07   98  	spin_lock_irqsave(&ci->lock, flags);
2d6512892c10655 Alexander Shishkin  2013-03-30   99  	ret = hw_port_test_set(ci, mode);
26c696c678c4ce1 Richard Zhao        2012-07-07  100  	spin_unlock_irqrestore(&ci->lock, flags);
bc24937943d9f71 Li Jun              2015-07-29  101  	pm_runtime_put_sync(ci->dev);
e443b333629f82c Alexander Shishkin  2012-05-11  102  
2d6512892c10655 Alexander Shishkin  2013-03-30  103  	return ret ? ret : count;
e443b333629f82c Alexander Shishkin  2012-05-11  104  }
2d6512892c10655 Alexander Shishkin  2013-03-30  105  

:::::: The code at line 89 was first introduced by commit
:::::: bd5fb0aec3dd7cde7ec4c397b10e55d4c9626d8d usb: chipidea: debug: avoid out of bound read

:::::: TO: Heinrich Schuchardt <xypron.glpk@gmx.de>
:::::: CC: Peter Chen <peter.chen@freescale.com>

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

             reply	other threads:[~2026-03-12  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12  7:46 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-03-09  1:37 [axboe:rw_iter 155/471] drivers/usb/chipidea/debug.c:89 ci_port_test_write() warn: potential spectre issue 'buf' [w] kernel test robot

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=202603121510.vaiHWvfx-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.