Re: [djwong-xfs:mount-api-crash 91/104] fs/xfs/xfs_message.c:23:40: warning: address of array 'mp->m_super->s_id' will always evaluate to 'true'
by Darrick J. Wong
On Tue, Oct 29, 2019 at 08:39:25PM -0700, Nathan Chancellor wrote:
> On Tue, Oct 29, 2019 at 02:45:40PM +0800, kbuild test robot wrote:
> > CC: kbuild-all(a)lists.01.org
> > CC: "Darrick J. Wong" <darrick.wong(a)oracle.com>
> > TO: Ian Kent <raven(a)themaw.net>
> > CC: "Darrick J. Wong" <darrick.wong(a)oracle.com>
> > CC: Christoph Hellwig <hch(a)lst.de>
FYI, It's customary to cc the patch author [and the xfs list]...
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git mount-api-crash
> > head: e35c37b1b9987c8d87d91dbeca6c24aade2a3390
> > commit: a5a36409da3a608c815b38b0ff2eb5bcfc1adec6 [91/104] xfs: use super s_id instead of struct xfs_mount
> > config: x86_64-rhel-7.6 (attached as .config)
> > compiler: clang version 10.0.0 (git://gitmirror/llvm_project 7cd595df96d5929488063d8ff5cc3b5d800386da)
> > reproduce:
> > git checkout a5a36409da3a608c815b38b0ff2eb5bcfc1adec6
> > # save the attached .config to linux build tree
> > make ARCH=x86_64
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp(a)intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> fs/xfs/xfs_message.c:23:40: warning: address of array 'mp->m_super->s_id' will always evaluate to 'true' [-Wpointer-bool-conversion]
> > if (mp && mp->m_super && mp->m_super->s_id) {
> > ~~ ~~~~~~~~~~~~~^~~~
...so, Ian, I guess this isn't necessary ^^^^^^^^^^^^^^^^
because it's a char array, not a pointer. :)
Good catch!
--D
> > 1 warning generated.
> >
> > vim +23 fs/xfs/xfs_message.c
> >
> > 13
> > 14 /*
> > 15 * XFS logging functions
> > 16 */
> > 17 static void
> > 18 __xfs_printk(
> > 19 const char *level,
> > 20 const struct xfs_mount *mp,
> > 21 struct va_format *vaf)
> > 22 {
> > > 23 if (mp && mp->m_super && mp->m_super->s_id) {
> > 24 printk("%sXFS (%s): %pV\n", level, mp->m_super->s_id, vaf);
> > 25 return;
> > 26 }
> > 27 printk("%sXFS: %pV\n", level, vaf);
> > 28 }
> > 29
> >
> > ---
> > 0-DAY kernel test infrastructure Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all Intel Corporation
> >
>
> Hi Darrick,
>
> The 0day team has been doing clang builds for us and we've been
> forwarding the valid warnings along to developers. This appeared after
> the commit listed above. That check should be unnecessary, perhaps you
> meant to check for something else? Thanks for looking into this.
>
> Cheers,
> Nathan
2 years, 7 months
Re: drivers/usb/usbip/stub_rx.c:505 stub_recv_cmd_submit() error: uninitialized symbol 'nents'.
by Dan Carpenter
On Sat, Oct 26, 2019 at 11:41:41AM +0900, Suwan Kim wrote:
> On Thu, Oct 24, 2019 at 04:52:52PM -0600, shuah wrote:
> > On 10/24/19 1:45 PM, Dan Carpenter wrote:
> > > On Wed, Oct 23, 2019 at 04:11:20PM +0900, Suwan Kim wrote:
> > > > On Tue, Oct 22, 2019 at 12:28:39PM +0300, Dan Carpenter wrote:
> > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > > > head: 7d194c2100ad2a6dded545887d02754948ca5241
> > > > > commit: ea44d190764b4422af4d1c29eaeb9e69e353b406 usbip: Implement SG support to vhci-hcd and stub driver
> > > > > date: 7 weeks ago
> > > > >
> > > > > If you fix the issue, kindly add following tag
> > > > > Reported-by: kbuild test robot <lkp(a)intel.com>
> > > > > Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
> > > > >
> > > > > New smatch warnings:
> > > > > drivers/usb/usbip/stub_rx.c:505 stub_recv_cmd_submit() error: uninitialized symbol 'nents'.
> > > > >
> > > > > Old smatch warnings:
> > > > > drivers/usb/usbip/stub_rx.c:450 stub_recv_xbuff() error: uninitialized symbol 'ret'.
>
> Here, ret is not initialized, meaning priv->num_urbs is 0.
> priv->urbs must be greater than zero.
> priv->num_urbs = 0 means nents is 0 (line 505)
>
> Dan, What is the relationship between old and new warnings?
> priv->num_urbs is set as value of "num_urbs" at stub_recv_cmd_submit()
> and "num_urbs" is initialized as 1 first. "num_urbs" will be reset
> only at the place where smatch new warnings happened (line 505).
>
> So, In my opinion, old smatch warnings should occur after the new
> smatch warnings. Does this look right to you?
I don't know exactly how the 0day bot runs Smatch. If you have cross
function analysis enabled then silencing the uninitialized "nents"
warning will also silence the uninitialized "ret" warning.
regards,
dan carpenter
2 years, 7 months
[linux-review:UPDATE-20191027-161609/Michal-Suchanek/Fix-cdrom-autoclose/20191025-101637 7/8] drivers/scsi/scsi_devinfo.c:458 scsi_dev_info_list_find() warn: add some parenthesis here?
by Dan Carpenter
tree: https://github.com/0day-ci/linux/commits/UPDATE-20191027-161609/Michal-Su...
head: 8ebc37a465cccfa1f297f976e1bd8b36ede36db3
commit: 6bb0f3478cfa38409ec750b5c99dda95acf6fdc8 [7/8] scsi: blacklist: add VMware ESXi cdrom - broken tray emulation.
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/scsi/scsi_devinfo.c:458 scsi_dev_info_list_find() warn: add some parenthesis here?
drivers/scsi/scsi_devinfo.c:458 scsi_dev_info_list_find() warn: maybe use && instead of &
# https://github.com/0day-ci/linux/commit/6bb0f3478cfa38409ec750b5c99dda95a...
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 6bb0f3478cfa38409ec750b5c99dda95acf6fdc8
vim +458 drivers/scsi/scsi_devinfo.c
c42b3654f48bc0 Alan Stern 2015-08-03 411 static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
4b1d8e78615d1a Bart Van Assche 2017-12-04 412 const char *model, enum scsi_devinfo_key key)
38a039be2e7bda Peter Jones 2011-01-06 413 {
c42b3654f48bc0 Alan Stern 2015-08-03 414 struct scsi_dev_info_list *devinfo;
38a039be2e7bda Peter Jones 2011-01-06 415 struct scsi_dev_info_list_table *devinfo_table =
38a039be2e7bda Peter Jones 2011-01-06 416 scsi_devinfo_lookup_by_key(key);
b8018b973c7cef Hannes Reinecke 2017-10-02 417 size_t vmax, mmax, mlen;
b704f70ce2003c Alan Stern 2015-08-03 418 const char *vskip, *mskip;
38a039be2e7bda Peter Jones 2011-01-06 419
38a039be2e7bda Peter Jones 2011-01-06 420 if (IS_ERR(devinfo_table))
c42b3654f48bc0 Alan Stern 2015-08-03 421 return (struct scsi_dev_info_list *) devinfo_table;
38a039be2e7bda Peter Jones 2011-01-06 422
b704f70ce2003c Alan Stern 2015-08-03 423 /* Prepare for "compatible" matches */
b704f70ce2003c Alan Stern 2015-08-03 424
38a039be2e7bda Peter Jones 2011-01-06 425 /*
38a039be2e7bda Peter Jones 2011-01-06 426 * XXX why skip leading spaces? If an odd INQUIRY
38a039be2e7bda Peter Jones 2011-01-06 427 * value, that should have been part of the
38a039be2e7bda Peter Jones 2011-01-06 428 * scsi_static_device_list[] entry, such as " FOO"
38a039be2e7bda Peter Jones 2011-01-06 429 * rather than "FOO". Since this code is already
38a039be2e7bda Peter Jones 2011-01-06 430 * here, and we don't know what device it is
38a039be2e7bda Peter Jones 2011-01-06 431 * trying to work with, leave it as-is.
38a039be2e7bda Peter Jones 2011-01-06 432 */
5e7ff2ca7f2da5 Alan Stern 2016-06-23 433 vmax = sizeof(devinfo->vendor);
b704f70ce2003c Alan Stern 2015-08-03 434 vskip = vendor;
b704f70ce2003c Alan Stern 2015-08-03 435 while (vmax > 0 && *vskip == ' ') {
b704f70ce2003c Alan Stern 2015-08-03 436 vmax--;
b704f70ce2003c Alan Stern 2015-08-03 437 vskip++;
b704f70ce2003c Alan Stern 2015-08-03 438 }
b704f70ce2003c Alan Stern 2015-08-03 439 /* Also skip trailing spaces */
b704f70ce2003c Alan Stern 2015-08-03 440 while (vmax > 0 && vskip[vmax - 1] == ' ')
b704f70ce2003c Alan Stern 2015-08-03 441 --vmax;
b704f70ce2003c Alan Stern 2015-08-03 442
5e7ff2ca7f2da5 Alan Stern 2016-06-23 443 mmax = sizeof(devinfo->model);
b704f70ce2003c Alan Stern 2015-08-03 444 mskip = model;
b704f70ce2003c Alan Stern 2015-08-03 445 while (mmax > 0 && *mskip == ' ') {
b704f70ce2003c Alan Stern 2015-08-03 446 mmax--;
b704f70ce2003c Alan Stern 2015-08-03 447 mskip++;
38a039be2e7bda Peter Jones 2011-01-06 448 }
b704f70ce2003c Alan Stern 2015-08-03 449 while (mmax > 0 && mskip[mmax - 1] == ' ')
b704f70ce2003c Alan Stern 2015-08-03 450 --mmax;
b704f70ce2003c Alan Stern 2015-08-03 451
b704f70ce2003c Alan Stern 2015-08-03 452 list_for_each_entry(devinfo, &devinfo_table->scsi_dev_info_list,
b704f70ce2003c Alan Stern 2015-08-03 453 dev_info_list) {
b704f70ce2003c Alan Stern 2015-08-03 454 if (devinfo->compatible) {
38a039be2e7bda Peter Jones 2011-01-06 455 /*
b8018b973c7cef Hannes Reinecke 2017-10-02 456 * vendor strings must be an exact match
38a039be2e7bda Peter Jones 2011-01-06 457 */
6bb0f3478cfa38 Michal Suchanek 2019-10-24 @458 if (!devinfo->flags & BLIST_MATCH_VENDOR)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is a precedence bug because ! is higher precedence than &. It
should be:
if (!(devinfo->flags & BLIST_MATCH_VENDOR))
ba69ead9e9e9bb Martin Wilck 2017-11-27 459 if (vmax != strnlen(devinfo->vendor,
ba69ead9e9e9bb Martin Wilck 2017-11-27 460 sizeof(devinfo->vendor)) ||
b8018b973c7cef Hannes Reinecke 2017-10-02 461 memcmp(devinfo->vendor, vskip, vmax))
38a039be2e7bda Peter Jones 2011-01-06 462 continue;
b8018b973c7cef Hannes Reinecke 2017-10-02 463
b8018b973c7cef Hannes Reinecke 2017-10-02 464 /*
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
2 years, 8 months
[djwong-xfs:verifier-fixes 70/141] fs/xfs/xfs_icache.c:628 xfs_iget_cache_hit() warn: inconsistent returns 'spin_lock:&ip->i_flags_lock'.
by Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git verifier-fixes
head: 789f4f4f1e144b5648c608d12771aefe85d36e61
commit: 3d361022d5b9c9a6a55270b99055788130d840ca [70/141] xfs: deferred inode inactivation
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
fs/xfs/xfs_icache.c:628 xfs_iget_cache_hit() warn: inconsistent returns 'spin_lock:&ip->i_flags_lock'.
Locked on: line 601
Unlocked on: line 623
Old smatch warnings:
include/linux/compiler.h:226 __write_once_size() warn: potential memory corrupting cast 8 vs 4 bytes
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/comm...
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git remote update djwong-xfs
git checkout 3d361022d5b9c9a6a55270b99055788130d840ca
vim +628 fs/xfs/xfs_icache.c
33479e0542df06 Dave Chinner 2012-10-08 473 static int
33479e0542df06 Dave Chinner 2012-10-08 474 xfs_iget_cache_hit(
33479e0542df06 Dave Chinner 2012-10-08 475 struct xfs_perag *pag,
33479e0542df06 Dave Chinner 2012-10-08 476 struct xfs_inode *ip,
33479e0542df06 Dave Chinner 2012-10-08 477 xfs_ino_t ino,
33479e0542df06 Dave Chinner 2012-10-08 478 int flags,
33479e0542df06 Dave Chinner 2012-10-08 479 int lock_flags) __releases(RCU)
33479e0542df06 Dave Chinner 2012-10-08 480 {
33479e0542df06 Dave Chinner 2012-10-08 481 struct inode *inode = VFS_I(ip);
33479e0542df06 Dave Chinner 2012-10-08 482 struct xfs_mount *mp = ip->i_mount;
33479e0542df06 Dave Chinner 2012-10-08 483 int error;
33479e0542df06 Dave Chinner 2012-10-08 484
33479e0542df06 Dave Chinner 2012-10-08 485 /*
33479e0542df06 Dave Chinner 2012-10-08 486 * check for re-use of an inode within an RCU grace period due to the
33479e0542df06 Dave Chinner 2012-10-08 487 * radix tree nodes not being updated yet. We monitor for this by
33479e0542df06 Dave Chinner 2012-10-08 488 * setting the inode number to zero before freeing the inode structure.
33479e0542df06 Dave Chinner 2012-10-08 489 * If the inode has been reallocated and set up, then the inode number
33479e0542df06 Dave Chinner 2012-10-08 490 * will not match, so check for that, too.
33479e0542df06 Dave Chinner 2012-10-08 491 */
33479e0542df06 Dave Chinner 2012-10-08 492 spin_lock(&ip->i_flags_lock);
33479e0542df06 Dave Chinner 2012-10-08 493 if (ip->i_ino != ino) {
33479e0542df06 Dave Chinner 2012-10-08 494 trace_xfs_iget_skip(ip);
ff6d6af2351cae Bill O'Donnell 2015-10-12 495 XFS_STATS_INC(mp, xs_ig_frecycle);
2451337dd04390 Dave Chinner 2014-06-25 496 error = -EAGAIN;
33479e0542df06 Dave Chinner 2012-10-08 497 goto out_error;
33479e0542df06 Dave Chinner 2012-10-08 498 }
33479e0542df06 Dave Chinner 2012-10-08 499
33479e0542df06 Dave Chinner 2012-10-08 500
33479e0542df06 Dave Chinner 2012-10-08 501 /*
33479e0542df06 Dave Chinner 2012-10-08 502 * If we are racing with another cache hit that is currently
33479e0542df06 Dave Chinner 2012-10-08 503 * instantiating this inode or currently recycling it out of
3d361022d5b9c9 Darrick J. Wong 2019-08-30 504 * reclaimable state, wait for the initialisation to complete
33479e0542df06 Dave Chinner 2012-10-08 505 * before continuing.
33479e0542df06 Dave Chinner 2012-10-08 506 *
33479e0542df06 Dave Chinner 2012-10-08 507 * XXX(hch): eventually we should do something equivalent to
33479e0542df06 Dave Chinner 2012-10-08 508 * wait_on_inode to wait for these flags to be cleared
33479e0542df06 Dave Chinner 2012-10-08 509 * instead of polling for it.
33479e0542df06 Dave Chinner 2012-10-08 510 */
3d361022d5b9c9 Darrick J. Wong 2019-08-30 511 if (ip->i_flags & (XFS_INEW | XFS_IRECLAIM | XFS_INACTIVATING)) {
33479e0542df06 Dave Chinner 2012-10-08 512 trace_xfs_iget_skip(ip);
ff6d6af2351cae Bill O'Donnell 2015-10-12 513 XFS_STATS_INC(mp, xs_ig_frecycle);
2451337dd04390 Dave Chinner 2014-06-25 514 error = -EAGAIN;
33479e0542df06 Dave Chinner 2012-10-08 515 goto out_error;
33479e0542df06 Dave Chinner 2012-10-08 516 }
33479e0542df06 Dave Chinner 2012-10-08 517
33479e0542df06 Dave Chinner 2012-10-08 518 /*
afca6c5b2595fc Dave Chinner 2018-04-17 519 * Check the inode free state is valid. This also detects lookup
afca6c5b2595fc Dave Chinner 2018-04-17 520 * racing with unlinks.
33479e0542df06 Dave Chinner 2012-10-08 521 */
afca6c5b2595fc Dave Chinner 2018-04-17 522 error = xfs_iget_check_free_state(ip, flags);
afca6c5b2595fc Dave Chinner 2018-04-17 523 if (error)
33479e0542df06 Dave Chinner 2012-10-08 524 goto out_error;
33479e0542df06 Dave Chinner 2012-10-08 525
33479e0542df06 Dave Chinner 2012-10-08 526 /*
33479e0542df06 Dave Chinner 2012-10-08 527 * If IRECLAIMABLE is set, we've torn down the VFS inode already.
33479e0542df06 Dave Chinner 2012-10-08 528 * Need to carefully get it back into useable state.
33479e0542df06 Dave Chinner 2012-10-08 529 */
33479e0542df06 Dave Chinner 2012-10-08 530 if (ip->i_flags & XFS_IRECLAIMABLE) {
33479e0542df06 Dave Chinner 2012-10-08 531 trace_xfs_iget_reclaim(ip);
33479e0542df06 Dave Chinner 2012-10-08 532
378f681c4b588c Darrick J. Wong 2017-06-19 533 if (flags & XFS_IGET_INCORE) {
378f681c4b588c Darrick J. Wong 2017-06-19 534 error = -EAGAIN;
378f681c4b588c Darrick J. Wong 2017-06-19 535 goto out_error;
378f681c4b588c Darrick J. Wong 2017-06-19 536 }
378f681c4b588c Darrick J. Wong 2017-06-19 537
33479e0542df06 Dave Chinner 2012-10-08 538 /*
33479e0542df06 Dave Chinner 2012-10-08 539 * We need to set XFS_IRECLAIM to prevent xfs_reclaim_inode
33479e0542df06 Dave Chinner 2012-10-08 540 * from stomping over us while we recycle the inode. We can't
33479e0542df06 Dave Chinner 2012-10-08 541 * clear the radix tree reclaimable tag yet as it requires
33479e0542df06 Dave Chinner 2012-10-08 542 * pag_ici_lock to be held exclusive.
33479e0542df06 Dave Chinner 2012-10-08 543 */
33479e0542df06 Dave Chinner 2012-10-08 544 ip->i_flags |= XFS_IRECLAIM;
33479e0542df06 Dave Chinner 2012-10-08 545
33479e0542df06 Dave Chinner 2012-10-08 546 spin_unlock(&ip->i_flags_lock);
33479e0542df06 Dave Chinner 2012-10-08 547 rcu_read_unlock();
33479e0542df06 Dave Chinner 2012-10-08 548
50997470ef95fd Dave Chinner 2016-02-09 549 error = xfs_reinit_inode(mp, inode);
33479e0542df06 Dave Chinner 2012-10-08 550 if (error) {
756baca27fff3e Brian Foster 2017-04-26 551 bool wake;
33479e0542df06 Dave Chinner 2012-10-08 552 /*
33479e0542df06 Dave Chinner 2012-10-08 553 * Re-initializing the inode failed, and we are in deep
33479e0542df06 Dave Chinner 2012-10-08 554 * trouble. Try to re-add it to the reclaim list.
33479e0542df06 Dave Chinner 2012-10-08 555 */
33479e0542df06 Dave Chinner 2012-10-08 556 rcu_read_lock();
33479e0542df06 Dave Chinner 2012-10-08 557 spin_lock(&ip->i_flags_lock);
756baca27fff3e Brian Foster 2017-04-26 558 wake = !!__xfs_iflags_test(ip, XFS_INEW);
33479e0542df06 Dave Chinner 2012-10-08 559 ip->i_flags &= ~(XFS_INEW | XFS_IRECLAIM);
756baca27fff3e Brian Foster 2017-04-26 560 if (wake)
756baca27fff3e Brian Foster 2017-04-26 561 wake_up_bit(&ip->i_flags, __XFS_INEW_BIT);
33479e0542df06 Dave Chinner 2012-10-08 562 ASSERT(ip->i_flags & XFS_IRECLAIMABLE);
33479e0542df06 Dave Chinner 2012-10-08 563 trace_xfs_iget_reclaim_fail(ip);
33479e0542df06 Dave Chinner 2012-10-08 564 goto out_error;
33479e0542df06 Dave Chinner 2012-10-08 565 }
33479e0542df06 Dave Chinner 2012-10-08 566
33479e0542df06 Dave Chinner 2012-10-08 567 spin_lock(&pag->pag_ici_lock);
33479e0542df06 Dave Chinner 2012-10-08 568 spin_lock(&ip->i_flags_lock);
33479e0542df06 Dave Chinner 2012-10-08 569
33479e0542df06 Dave Chinner 2012-10-08 570 /*
33479e0542df06 Dave Chinner 2012-10-08 571 * Clear the per-lifetime state in the inode as we are now
33479e0542df06 Dave Chinner 2012-10-08 572 * effectively a new inode and need to return to the initial
33479e0542df06 Dave Chinner 2012-10-08 573 * state before reuse occurs.
33479e0542df06 Dave Chinner 2012-10-08 574 */
33479e0542df06 Dave Chinner 2012-10-08 575 ip->i_flags &= ~XFS_IRECLAIM_RESET_FLAGS;
33479e0542df06 Dave Chinner 2012-10-08 576 ip->i_flags |= XFS_INEW;
545c0889d26d47 Dave Chinner 2016-05-18 577 xfs_inode_clear_reclaim_tag(pag, ip->i_ino);
33479e0542df06 Dave Chinner 2012-10-08 578 inode->i_state = I_NEW;
6772c1f11206f2 Darrick J. Wong 2019-04-12 579 ip->i_sick = 0;
6772c1f11206f2 Darrick J. Wong 2019-04-12 580 ip->i_checked = 0;
33479e0542df06 Dave Chinner 2012-10-08 581
6552321831dce8 Christoph Hellwig 2016-11-30 582 ASSERT(!rwsem_is_locked(&inode->i_rwsem));
6552321831dce8 Christoph Hellwig 2016-11-30 583 init_rwsem(&inode->i_rwsem);
33479e0542df06 Dave Chinner 2012-10-08 584
33479e0542df06 Dave Chinner 2012-10-08 585 spin_unlock(&ip->i_flags_lock);
33479e0542df06 Dave Chinner 2012-10-08 586 spin_unlock(&pag->pag_ici_lock);
3d361022d5b9c9 Darrick J. Wong 2019-08-30 587 } else if (ip->i_flags & XFS_NEED_INACTIVE) {
3d361022d5b9c9 Darrick J. Wong 2019-08-30 588 /*
3d361022d5b9c9 Darrick J. Wong 2019-08-30 589 * If NEED_INACTIVE is set, we've torn down the VFS inode and
3d361022d5b9c9 Darrick J. Wong 2019-08-30 590 * need to carefully get it back into useable state.
3d361022d5b9c9 Darrick J. Wong 2019-08-30 591 */
3d361022d5b9c9 Darrick J. Wong 2019-08-30 592 trace_xfs_iget_inactive(ip);
3d361022d5b9c9 Darrick J. Wong 2019-08-30 593
3d361022d5b9c9 Darrick J. Wong 2019-08-30 594 if (flags & XFS_IGET_INCORE) {
3d361022d5b9c9 Darrick J. Wong 2019-08-30 595 error = -EAGAIN;
3d361022d5b9c9 Darrick J. Wong 2019-08-30 596 goto out_error;
3d361022d5b9c9 Darrick J. Wong 2019-08-30 597 }
3d361022d5b9c9 Darrick J. Wong 2019-08-30 598
3d361022d5b9c9 Darrick J. Wong 2019-08-30 599 error = xfs_iget_inactive(pag, ip);
3d361022d5b9c9 Darrick J. Wong 2019-08-30 600 if (error)
3d361022d5b9c9 Darrick J. Wong 2019-08-30 601 return error;
goto out_error;
33479e0542df06 Dave Chinner 2012-10-08 602 } else {
33479e0542df06 Dave Chinner 2012-10-08 603 /* If the VFS inode is being torn down, pause and try again. */
33479e0542df06 Dave Chinner 2012-10-08 604 if (!igrab(inode)) {
33479e0542df06 Dave Chinner 2012-10-08 605 trace_xfs_iget_skip(ip);
2451337dd04390 Dave Chinner 2014-06-25 606 error = -EAGAIN;
33479e0542df06 Dave Chinner 2012-10-08 607 goto out_error;
33479e0542df06 Dave Chinner 2012-10-08 608 }
33479e0542df06 Dave Chinner 2012-10-08 609
33479e0542df06 Dave Chinner 2012-10-08 610 /* We've got a live one. */
33479e0542df06 Dave Chinner 2012-10-08 611 spin_unlock(&ip->i_flags_lock);
33479e0542df06 Dave Chinner 2012-10-08 612 rcu_read_unlock();
33479e0542df06 Dave Chinner 2012-10-08 613 trace_xfs_iget_hit(ip);
33479e0542df06 Dave Chinner 2012-10-08 614 }
33479e0542df06 Dave Chinner 2012-10-08 615
33479e0542df06 Dave Chinner 2012-10-08 616 if (lock_flags != 0)
33479e0542df06 Dave Chinner 2012-10-08 617 xfs_ilock(ip, lock_flags);
33479e0542df06 Dave Chinner 2012-10-08 618
378f681c4b588c Darrick J. Wong 2017-06-19 619 if (!(flags & XFS_IGET_INCORE))
33479e0542df06 Dave Chinner 2012-10-08 620 xfs_iflags_clear(ip, XFS_ISTALE | XFS_IDONTCACHE);
ff6d6af2351cae Bill O'Donnell 2015-10-12 621 XFS_STATS_INC(mp, xs_ig_found);
33479e0542df06 Dave Chinner 2012-10-08 622
33479e0542df06 Dave Chinner 2012-10-08 623 return 0;
33479e0542df06 Dave Chinner 2012-10-08 624
33479e0542df06 Dave Chinner 2012-10-08 625 out_error:
33479e0542df06 Dave Chinner 2012-10-08 626 spin_unlock(&ip->i_flags_lock);
33479e0542df06 Dave Chinner 2012-10-08 627 rcu_read_unlock();
33479e0542df06 Dave Chinner 2012-10-08 @628 return error;
33479e0542df06 Dave Chinner 2012-10-08 629 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
2 years, 8 months
[plbossart-sound:integration/soundwire-20191022 51/53] drivers/soundwire/stream.c:1557 sdw_prepare_stream() warn: variable dereferenced before check 'stream' (see line 1555)
by Dan Carpenter
tree: https://github.com/plbossart/sound integration/soundwire-20191022
head: 40ac17aeeb4954510b3db3a8314fa5ab3a0169f6
commit: 8b1325343c5c750a0b25120bf354c7a73cfda4c6 [51/53] [HACK] add traces to debug aplay suspend/resume issue
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
drivers/soundwire/stream.c:1557 sdw_prepare_stream() warn: variable dereferenced before check 'stream' (see line 1555)
drivers/soundwire/stream.c:1655 sdw_enable_stream() warn: variable dereferenced before check 'stream' (see line 1653)
drivers/soundwire/stream.c:1744 sdw_disable_stream() warn: variable dereferenced before check 'stream' (see line 1742)
drivers/soundwire/stream.c:1816 sdw_deprepare_stream() warn: variable dereferenced before check 'stream' (see line 1814)
Old smatch warnings:
drivers/soundwire/stream.c:102 _sdw_program_slave_port_params() warn: '(t_params->sample_interval - 1)' 4294967295 can't fit into 65535 'wbuf'
include/linux/compiler.h:226 __write_once_size() warn: potential memory corrupting cast 8 vs 4 bytes
# https://github.com/plbossart/sound/commit/8b1325343c5c750a0b25120bf354c7a...
git remote add plbossart-sound https://github.com/plbossart/sound
git remote update plbossart-sound
git checkout 8b1325343c5c750a0b25120bf354c7a73cfda4c6
vim +/stream +1557 drivers/soundwire/stream.c
5c3eb9f7bdf1f1 Sanyog Kale 2018-04-26 1550 int sdw_prepare_stream(struct sdw_stream_runtime *stream)
5c3eb9f7bdf1f1 Sanyog Kale 2018-04-26 1551 {
564e8992e95ea1 Pierre-Louis Bossart 2019-10-15 1552 bool update_params = true;
36269dcfbd2d7f Bard Liao 2019-09-20 1553 int ret;
5c3eb9f7bdf1f1 Sanyog Kale 2018-04-26 1554
8b1325343c5c75 Pierre-Louis Bossart 2019-10-12 @1555 pr_err("%s: %s start\n", __func__, stream->name);
^^^^^^^^^^^^
Unchecked dereference.
8b1325343c5c75 Pierre-Louis Bossart 2019-10-12 1556
5c3eb9f7bdf1f1 Sanyog Kale 2018-04-26 @1557 if (!stream) {
^^^^^^^
Too late.
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01 1558 pr_err("SoundWire: Handle not found for stream\n");
5c3eb9f7bdf1f1 Sanyog Kale 2018-04-26 1559 return -EINVAL;
5c3eb9f7bdf1f1 Sanyog Kale 2018-04-26 1560 }
5c3eb9f7bdf1f1 Sanyog Kale 2018-04-26 1561
48949722ced4da Vinod Koul 2018-07-27 1562 sdw_acquire_bus_lock(stream);
5c3eb9f7bdf1f1 Sanyog Kale 2018-04-26 1563
36269dcfbd2d7f Bard Liao 2019-09-20 1564 if (stream->state == SDW_STREAM_PREPARED) {
36269dcfbd2d7f Bard Liao 2019-09-20 1565 ret = 0;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
2 years, 8 months
Re: drivers/usb/usbip/stub_rx.c:505 stub_recv_cmd_submit() error: uninitialized symbol 'nents'.
by Dan Carpenter
On Wed, Oct 23, 2019 at 04:11:20PM +0900, Suwan Kim wrote:
> On Tue, Oct 22, 2019 at 12:28:39PM +0300, Dan Carpenter wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 7d194c2100ad2a6dded545887d02754948ca5241
> > commit: ea44d190764b4422af4d1c29eaeb9e69e353b406 usbip: Implement SG support to vhci-hcd and stub driver
> > date: 7 weeks ago
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp(a)intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
> >
> > New smatch warnings:
> > drivers/usb/usbip/stub_rx.c:505 stub_recv_cmd_submit() error: uninitialized symbol 'nents'.
> >
> > Old smatch warnings:
> > drivers/usb/usbip/stub_rx.c:450 stub_recv_xbuff() error: uninitialized symbol 'ret'.
> >
> > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
> > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > git remote update linus
> > git checkout ea44d190764b4422af4d1c29eaeb9e69e353b406
> > vim +/nents +505 drivers/usb/usbip/stub_rx.c
> >
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 453 static void stub_recv_cmd_submit(struct stub_device *sdev,
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 454 struct usbip_header *pdu)
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 455 {
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 456 struct stub_priv *priv;
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 457 struct usbip_device *ud = &sdev->ud;
> > 2d8f4595d1f275 drivers/staging/usbip/stub_rx.c Max Vozeler 2011-01-12 458 struct usb_device *udev = sdev->udev;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 459 struct scatterlist *sgl = NULL, *sg;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 460 void *buffer = NULL;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 461 unsigned long long buf_len;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 462 int nents;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 463 int num_urbs = 1;
> > c6688ef9f29762 drivers/usb/usbip/stub_rx.c Shuah Khan 2017-12-07 464 int pipe = get_pipe(sdev, pdu);
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 465 int use_sg = pdu->u.cmd_submit.transfer_flags & URB_DMA_MAP_SG;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 466 int support_sg = 1;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 467 int np = 0;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 468 int ret, i;
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 469
> > 635f545a7e8be7 drivers/usb/usbip/stub_rx.c Shuah Khan 2017-12-07 470 if (pipe == -1)
> > 635f545a7e8be7 drivers/usb/usbip/stub_rx.c Shuah Khan 2017-12-07 471 return;
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 472
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 473 priv = stub_priv_alloc(sdev, pdu);
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 474 if (!priv)
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 475 return;
> > 4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 476
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 477 buf_len = (unsigned long long)pdu->u.cmd_submit.transfer_buffer_length;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 478
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 479 /* allocate urb transfer buffer, if needed */
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 480 if (buf_len) {
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 481 if (use_sg) {
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 482 sgl = sgl_alloc(buf_len, GFP_KERNEL, &nents);
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 483 if (!sgl)
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 484 goto err_malloc;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 485 } else {
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 486 buffer = kzalloc(buf_len, GFP_KERNEL);
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 487 if (!buffer)
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 488 goto err_malloc;
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 489 }
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 490 }
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 491
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 492 /* Check if the server's HCD supports SG */
> > ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 493 if (use_sg && !udev->bus->sg_tablesize) {
> >
> > Smatch thinks "use_sg" can be true when "buf_len" is zero. It's hard
> > to tell if Smatch is right or wrong without more context...
>
> This is a bit strange. The meaning of "use_sg" is that client will
> use scatter-gather and client's urb->num_sgs is not zero. And buffer
> length should not be zero.
>
> usb_sg and buf_len are both client-dependent variables, so I think
> if they have wrong value in the server side, the client must have
> sent use_sg and buf_len with incorrect values.
>
> Did this error occur when compiling?
Smatch is doing static analysis, yes.
> If then, Did Smatch also consider vhci tx side?
I'm not really sure... I can't reproduce the warning because on my
system Smatch doesn't parse usbip_recv() correctly so it ends up
silencing that warning. :/
regards,
dan carpenter
2 years, 8 months
[linux-next:master 5983/6376] net/dsa/dsa2.c:849 dsa_switch_probe() warn: variable dereferenced before check 'ds->dev' (see line 845)
by Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: f3c452cfc59c817950b150b51ec2b33409d7640b
commit: 7e99e34701728d54ccd0466eccf377a42b9db215 [5983/6376] net: dsa: remove dsa_switch_alloc helper
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
net/dsa/dsa2.c:849 dsa_switch_probe() warn: variable dereferenced before check 'ds->dev' (see line 845)
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update linux-next
git checkout 7e99e34701728d54ccd0466eccf377a42b9db215
vim +849 net/dsa/dsa2.c
b4fbb347fe4cd7 Vivien Didelot 2017-11-06 843 static int dsa_switch_probe(struct dsa_switch *ds)
83c0afaec7b730 Andrew Lunn 2016-06-04 844 {
23c9ee4934e7a7 Vivien Didelot 2017-05-26 @845 struct dsa_chip_data *pdata = ds->dev->platform_data;
^^^^^^^^^^^^^^^^^^^^^^
Dereference.
23c9ee4934e7a7 Vivien Didelot 2017-05-26 846 struct device_node *np = ds->dev->of_node;
34c09a8916fb52 Vivien Didelot 2017-11-06 847 int err;
83c0afaec7b730 Andrew Lunn 2016-06-04 848
7e99e34701728d Vivien Didelot 2019-10-21 @849 if (!ds->dev)
^^^^^^^
Check too late.
7e99e34701728d Vivien Didelot 2019-10-21 850 return -ENODEV;
7e99e34701728d Vivien Didelot 2019-10-21 851
7e99e34701728d Vivien Didelot 2019-10-21 852 if (!ds->num_ports)
7e99e34701728d Vivien Didelot 2019-10-21 853 return -EINVAL;
7e99e34701728d Vivien Didelot 2019-10-21 854
975e6e32215e6c Vivien Didelot 2017-11-03 855 if (np)
975e6e32215e6c Vivien Didelot 2017-11-03 856 err = dsa_switch_parse_of(ds, np);
975e6e32215e6c Vivien Didelot 2017-11-03 857 else if (pdata)
975e6e32215e6c Vivien Didelot 2017-11-03 858 err = dsa_switch_parse(ds, pdata);
975e6e32215e6c Vivien Didelot 2017-11-03 859 else
975e6e32215e6c Vivien Didelot 2017-11-03 860 err = -ENODEV;
83c0afaec7b730 Andrew Lunn 2016-06-04 861
0eefe2c1730020 Vivien Didelot 2017-11-03 862 if (err)
0eefe2c1730020 Vivien Didelot 2017-11-03 863 return err;
975e6e32215e6c Vivien Didelot 2017-11-03 864
308173546ac434 Vivien Didelot 2017-11-06 865 return dsa_switch_add(ds);
83c0afaec7b730 Andrew Lunn 2016-06-04 866 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
2 years, 8 months
drivers/usb/usbip/stub_rx.c:505 stub_recv_cmd_submit() error: uninitialized symbol 'nents'.
by Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7d194c2100ad2a6dded545887d02754948ca5241
commit: ea44d190764b4422af4d1c29eaeb9e69e353b406 usbip: Implement SG support to vhci-hcd and stub driver
date: 7 weeks ago
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
drivers/usb/usbip/stub_rx.c:505 stub_recv_cmd_submit() error: uninitialized symbol 'nents'.
Old smatch warnings:
drivers/usb/usbip/stub_rx.c:450 stub_recv_xbuff() error: uninitialized symbol 'ret'.
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout ea44d190764b4422af4d1c29eaeb9e69e353b406
vim +/nents +505 drivers/usb/usbip/stub_rx.c
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 453 static void stub_recv_cmd_submit(struct stub_device *sdev,
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 454 struct usbip_header *pdu)
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 455 {
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 456 struct stub_priv *priv;
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 457 struct usbip_device *ud = &sdev->ud;
2d8f4595d1f275 drivers/staging/usbip/stub_rx.c Max Vozeler 2011-01-12 458 struct usb_device *udev = sdev->udev;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 459 struct scatterlist *sgl = NULL, *sg;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 460 void *buffer = NULL;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 461 unsigned long long buf_len;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 462 int nents;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 463 int num_urbs = 1;
c6688ef9f29762 drivers/usb/usbip/stub_rx.c Shuah Khan 2017-12-07 464 int pipe = get_pipe(sdev, pdu);
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 465 int use_sg = pdu->u.cmd_submit.transfer_flags & URB_DMA_MAP_SG;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 466 int support_sg = 1;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 467 int np = 0;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 468 int ret, i;
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 469
635f545a7e8be7 drivers/usb/usbip/stub_rx.c Shuah Khan 2017-12-07 470 if (pipe == -1)
635f545a7e8be7 drivers/usb/usbip/stub_rx.c Shuah Khan 2017-12-07 471 return;
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 472
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 473 priv = stub_priv_alloc(sdev, pdu);
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 474 if (!priv)
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 475 return;
4d7b5c7f8ad49b drivers/staging/usbip/stub_rx.c Takahiro Hirofuchi 2008-07-09 476
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 477 buf_len = (unsigned long long)pdu->u.cmd_submit.transfer_buffer_length;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 478
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 479 /* allocate urb transfer buffer, if needed */
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 480 if (buf_len) {
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 481 if (use_sg) {
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 482 sgl = sgl_alloc(buf_len, GFP_KERNEL, &nents);
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 483 if (!sgl)
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 484 goto err_malloc;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 485 } else {
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 486 buffer = kzalloc(buf_len, GFP_KERNEL);
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 487 if (!buffer)
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 488 goto err_malloc;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 489 }
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 490 }
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 491
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 492 /* Check if the server's HCD supports SG */
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 493 if (use_sg && !udev->bus->sg_tablesize) {
Smatch thinks "use_sg" can be true when "buf_len" is zero. It's hard
to tell if Smatch is right or wrong without more context...
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 494 /*
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 495 * If the server's HCD doesn't support SG, break a single SG
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 496 * request into several URBs and map each SG list entry to
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 497 * corresponding URB buffer. The previously allocated SG
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 498 * list is stored in priv->sgl (If the server's HCD support SG,
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 499 * SG list is stored only in urb->sg) and it is used as an
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 500 * indicator that the server split single SG request into
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 501 * several URBs. Later, priv->sgl is used by stub_complete() and
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 502 * stub_send_ret_submit() to reassemble the divied URBs.
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 503 */
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 504 support_sg = 0;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 @505 num_urbs = nents;
^^^^^^^^^^^^^^^^
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 506 priv->completed_urbs = 0;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 507 pdu->u.cmd_submit.transfer_flags &= ~URB_DMA_MAP_SG;
ea44d190764b44 drivers/usb/usbip/stub_rx.c Suwan Kim 2019-08-28 508 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
2 years, 8 months
Re: [PATCH v4 02/11] crypto: Add Allwinner sun8i-ce Crypto Engine
by Dan Carpenter
Hi Corentin,
url: https://github.com/0day-ci/linux/commits/Corentin-Labbe/crypto-add-sun8i-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c:371 sun8i_ce_allocate_chanlist() error: uninitialized symbol 'err'.
# https://github.com/0day-ci/linux/commit/f113059e7b4f94c545994aeafdc809a3e...
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout f113059e7b4f94c545994aeafdc809a3e4907ae4
vim +/err +371 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
f113059e7b4f94 Corentin Labbe 2019-10-12 334 static int sun8i_ce_allocate_chanlist(struct sun8i_ce_dev *ce)
f113059e7b4f94 Corentin Labbe 2019-10-12 335 {
f113059e7b4f94 Corentin Labbe 2019-10-12 336 int i, err;
f113059e7b4f94 Corentin Labbe 2019-10-12 337
f113059e7b4f94 Corentin Labbe 2019-10-12 338 ce->chanlist = devm_kcalloc(ce->dev, MAXFLOW,
f113059e7b4f94 Corentin Labbe 2019-10-12 339 sizeof(struct sun8i_ce_flow), GFP_KERNEL);
f113059e7b4f94 Corentin Labbe 2019-10-12 340 if (!ce->chanlist)
f113059e7b4f94 Corentin Labbe 2019-10-12 341 return -ENOMEM;
f113059e7b4f94 Corentin Labbe 2019-10-12 342
f113059e7b4f94 Corentin Labbe 2019-10-12 343 for (i = 0; i < MAXFLOW; i++) {
f113059e7b4f94 Corentin Labbe 2019-10-12 344 init_completion(&ce->chanlist[i].complete);
f113059e7b4f94 Corentin Labbe 2019-10-12 345
f113059e7b4f94 Corentin Labbe 2019-10-12 346 ce->chanlist[i].engine = crypto_engine_alloc_init(ce->dev, true);
f113059e7b4f94 Corentin Labbe 2019-10-12 347 if (!ce->chanlist[i].engine) {
f113059e7b4f94 Corentin Labbe 2019-10-12 348 dev_err(ce->dev, "Cannot allocate engine\n");
f113059e7b4f94 Corentin Labbe 2019-10-12 349 i--;
f113059e7b4f94 Corentin Labbe 2019-10-12 350 goto error_engine;
err = -ENOMEM;
f113059e7b4f94 Corentin Labbe 2019-10-12 351 }
f113059e7b4f94 Corentin Labbe 2019-10-12 352 err = crypto_engine_start(ce->chanlist[i].engine);
f113059e7b4f94 Corentin Labbe 2019-10-12 353 if (err) {
f113059e7b4f94 Corentin Labbe 2019-10-12 354 dev_err(ce->dev, "Cannot start engine\n");
f113059e7b4f94 Corentin Labbe 2019-10-12 355 goto error_engine;
f113059e7b4f94 Corentin Labbe 2019-10-12 356 }
f113059e7b4f94 Corentin Labbe 2019-10-12 357 ce->chanlist[i].tl = dma_alloc_coherent(ce->dev,
f113059e7b4f94 Corentin Labbe 2019-10-12 358 sizeof(struct ce_task),
f113059e7b4f94 Corentin Labbe 2019-10-12 359 &ce->chanlist[i].t_phy,
f113059e7b4f94 Corentin Labbe 2019-10-12 360 GFP_KERNEL);
f113059e7b4f94 Corentin Labbe 2019-10-12 361 if (!ce->chanlist[i].tl) {
f113059e7b4f94 Corentin Labbe 2019-10-12 362 dev_err(ce->dev, "Cannot get DMA memory for task %d\n",
f113059e7b4f94 Corentin Labbe 2019-10-12 363 i);
f113059e7b4f94 Corentin Labbe 2019-10-12 364 err = -ENOMEM;
f113059e7b4f94 Corentin Labbe 2019-10-12 365 goto error_engine;
f113059e7b4f94 Corentin Labbe 2019-10-12 366 }
f113059e7b4f94 Corentin Labbe 2019-10-12 367 }
f113059e7b4f94 Corentin Labbe 2019-10-12 368 return 0;
f113059e7b4f94 Corentin Labbe 2019-10-12 369 error_engine:
f113059e7b4f94 Corentin Labbe 2019-10-12 370 sun8i_ce_free_chanlist(ce, i);
f113059e7b4f94 Corentin Labbe 2019-10-12 @371 return err;
f113059e7b4f94 Corentin Labbe 2019-10-12 372 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
2 years, 8 months
[thierryreding:for-5.5/dp 79/124] drivers/memory/core.c:79 of_memory_controller_get() error: double unlock 'mutex:&controllers_lock'
by Dan Carpenter
tree: https://github.com/thierryreding/linux for-5.5/dp
head: c80326581f9bf16162c2f3d5dcc5f006bbc93f86
commit: 429583789bbda8c3ef59f9b6c33fb483145752a4 [79/124] memory: Introduce memory controller mini-framework
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
drivers/memory/core.c:79 of_memory_controller_get() error: double unlock 'mutex:&controllers_lock'
Old smatch warnings:
include/linux/compiler.h:226 __write_once_size() warn: potential memory corrupting cast 8 vs 4 bytes
# https://github.com/thierryreding/linux/commit/429583789bbda8c3ef59f9b6c33...
git remote add thierryreding https://github.com/thierryreding/linux
git remote update thierryreding
git checkout 429583789bbda8c3ef59f9b6c33fb483145752a4
vim +79 drivers/memory/core.c
429583789bbda8 Thierry Reding 2019-08-20 41 static struct memory_controller *
429583789bbda8 Thierry Reding 2019-08-20 42 of_memory_controller_get(struct device *dev, struct device_node *np,
429583789bbda8 Thierry Reding 2019-08-20 43 const char *con_id)
429583789bbda8 Thierry Reding 2019-08-20 44 {
429583789bbda8 Thierry Reding 2019-08-20 45 const char *cells = "#memory-controller-cells";
429583789bbda8 Thierry Reding 2019-08-20 46 const char *names = "memory-controller-names";
429583789bbda8 Thierry Reding 2019-08-20 47 const char *prop = "memory-controllers";
429583789bbda8 Thierry Reding 2019-08-20 48 struct memory_controller *mc;
429583789bbda8 Thierry Reding 2019-08-20 49 struct of_phandle_args args;
429583789bbda8 Thierry Reding 2019-08-20 50 int index = 0, err;
429583789bbda8 Thierry Reding 2019-08-20 51
429583789bbda8 Thierry Reding 2019-08-20 52 if (con_id) {
429583789bbda8 Thierry Reding 2019-08-20 53 index = of_property_match_string(np, names, con_id);
429583789bbda8 Thierry Reding 2019-08-20 54 if (index < 0)
429583789bbda8 Thierry Reding 2019-08-20 55 return ERR_PTR(index);
429583789bbda8 Thierry Reding 2019-08-20 56 }
429583789bbda8 Thierry Reding 2019-08-20 57
429583789bbda8 Thierry Reding 2019-08-20 58 err = of_parse_phandle_with_args(np, prop, cells, index, &args);
429583789bbda8 Thierry Reding 2019-08-20 59 if (err) {
429583789bbda8 Thierry Reding 2019-08-20 60 if (err == -ENOENT)
429583789bbda8 Thierry Reding 2019-08-20 61 err = -ENODEV;
429583789bbda8 Thierry Reding 2019-08-20 62
429583789bbda8 Thierry Reding 2019-08-20 63 return ERR_PTR(err);
429583789bbda8 Thierry Reding 2019-08-20 64 }
429583789bbda8 Thierry Reding 2019-08-20 65
429583789bbda8 Thierry Reding 2019-08-20 66 mutex_lock(&controllers_lock);
429583789bbda8 Thierry Reding 2019-08-20 67
429583789bbda8 Thierry Reding 2019-08-20 68 list_for_each_entry(mc, &controllers, list) {
429583789bbda8 Thierry Reding 2019-08-20 69 if (mc->dev && mc->dev->of_node == args.np) {
429583789bbda8 Thierry Reding 2019-08-20 70 kref_get(&mc->ref);
429583789bbda8 Thierry Reding 2019-08-20 71 mutex_unlock(&controllers_lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
429583789bbda8 Thierry Reding 2019-08-20 72 goto unlock;
429583789bbda8 Thierry Reding 2019-08-20 73 }
429583789bbda8 Thierry Reding 2019-08-20 74 }
429583789bbda8 Thierry Reding 2019-08-20 75
429583789bbda8 Thierry Reding 2019-08-20 76 mc = ERR_PTR(-EPROBE_DEFER);
429583789bbda8 Thierry Reding 2019-08-20 77
429583789bbda8 Thierry Reding 2019-08-20 78 unlock:
429583789bbda8 Thierry Reding 2019-08-20 @79 mutex_unlock(&controllers_lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
429583789bbda8 Thierry Reding 2019-08-20 80 of_node_put(args.np);
429583789bbda8 Thierry Reding 2019-08-20 81 return mc;
429583789bbda8 Thierry Reding 2019-08-20 82 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
2 years, 8 months