[kbuild] [ntb:ntb-next-djiang 2/2] drivers/ntb/ntb_transport.c:784 ntb_transport_link_work() warn: should '1 << ((val >> (i * 8)) & 255)' be a 64 bit type?

2015-04-05 Thread kbuild test robot
TO: Dave Jiang 
CC: Jon Mason 

tree:   git://github.com/jonmason/ntb ntb-next-djiang
head:   3ab45b3c3841a78b3ea3398c85518d2c56520743
commit: 3ab45b3c3841a78b3ea3398c85518d2c56520743 [2/2] ntb: workaround for high 
traffic hardware hang
:: branch date: 3 hours ago
:: commit date: 3 hours ago

drivers/ntb/ntb_transport.c:784 ntb_transport_link_work() warn: should '1 << 
((val >> (i * 8)) & 255)' be a 64 bit type?

git remote add ntb git://github.com/jonmason/ntb
git remote update ntb
git checkout 3ab45b3c3841a78b3ea3398c85518d2c56520743
vim +784 drivers/ntb/ntb_transport.c

fce8a7bb Jon Mason  2012-11-16  768  
3ab45b3c Dave Jiang 2014-09-08  769 dev_dbg(&pdev->dev, "Remote max number 
of qps = %d\n",
3ab45b3c Dave Jiang 2014-09-08  770 (val >> 16) & 0x);
fce8a7bb Jon Mason  2012-11-16  771  
3ab45b3c Dave Jiang 2014-09-08  772 if ((val & 0x) != ntb_max_mw(ndev))
3ab45b3c Dave Jiang 2014-09-08  773 goto out;
fce8a7bb Jon Mason  2012-11-16  774  
3ab45b3c Dave Jiang 2014-09-08  775 dev_dbg(&pdev->dev, "Remote number of 
mws = %d\n", val & 0x);
fce8a7bb Jon Mason  2012-11-16  776  
3ab45b3c Dave Jiang 2014-09-08  777 rc = ntb_read_remote_spad(ndev, MW_SZ, 
&val);
113fc505 Jon Mason  2013-01-30  778 if (rc) {
3ab45b3c Dave Jiang 2014-09-08  779 dev_err(&pdev->dev, "Error 
reading remote spad %d\n", MW_SZ);
113fc505 Jon Mason  2013-01-30  780 goto out1;
113fc505 Jon Mason  2013-01-30  781 }
113fc505 Jon Mason  2013-01-30  782  
3ab45b3c Dave Jiang 2014-09-08  783 for (i = 0; i < ntb_max_mw(ndev); i++) {
3ab45b3c Dave Jiang 2014-09-08 @784 u64 val64 = 1 << ((val >> (i * 
8)) & 0xff);
113fc505 Jon Mason  2013-01-30  785  
113fc505 Jon Mason  2013-01-30  786 dev_dbg(&pdev->dev, "Remote 
MW%d size = %llu\n", i, val64);
113fc505 Jon Mason  2013-01-30  787  
113fc505 Jon Mason  2013-01-30  788 rc = ntb_set_mw(nt, i, val64);
fce8a7bb Jon Mason  2012-11-16  789 if (rc)
113fc505 Jon Mason  2013-01-30  790 goto out1;
113fc505 Jon Mason  2013-01-30  791 }
fce8a7bb Jon Mason  2012-11-16  792  

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [vfs:for-next 65/66] fs/fuse/file.c:2837 fuse_direct_IO() warn: if statement not indented

2015-04-05 Thread kbuild test robot
TO: Omar Sandoval 
CC: Al Viro 

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-next
head:   7bfd391fd08e2c10efc4119833949faf6d50d7d7
commit: 48d8dc19de85b549007d636e4db6a8884c11fc96 [65/66] direct_IO: use 
iov_iter_rw() instead of rw everywhere
:: branch date: 4 hours ago
:: commit date: 4 hours ago

fs/fuse/file.c:2837 fuse_direct_IO() warn: if statement not indented

git remote add vfs git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git
git remote update vfs
git checkout 48d8dc19de85b549007d636e4db6a8884c11fc96
vim +2837 fs/fuse/file.c

bcba24cc Maxim Patlasov2012-12-14  2821 io->offset = offset;
48d8dc19 Omar Sandoval 2015-03-16  2822 io->write = (iov_iter_rw(iter) 
== WRITE);
bcba24cc Maxim Patlasov2012-12-14  2823 io->err = 0;
36cf66ed Maxim Patlasov2012-12-14  2824 io->file = file;
bcba24cc Maxim Patlasov2012-12-14  2825 /*
bcba24cc Maxim Patlasov2012-12-14  2826  * By default, we want to 
optimize all I/Os with async request
60b9df7a Miklos Szeredi2013-05-01  2827  * submission to the client 
filesystem if supported.
bcba24cc Maxim Patlasov2012-12-14  2828  */
e5c5f05d Maxim Patlasov2013-05-30  2829 io->async = async_dio;
bcba24cc Maxim Patlasov2012-12-14  2830 io->iocb = iocb;
bcba24cc Maxim Patlasov2012-12-14  2831  
bcba24cc Maxim Patlasov2012-12-14  2832 /*
bcba24cc Maxim Patlasov2012-12-14  2833  * We cannot asynchronously 
extend the size of a file. We have no method
bcba24cc Maxim Patlasov2012-12-14  2834  * to wait on real async I/O 
requests, so we must submit this request
bcba24cc Maxim Patlasov2012-12-14  2835  * synchronously.
bcba24cc Maxim Patlasov2012-12-14  2836  */
48d8dc19 Omar Sandoval 2015-03-16 @2837 if (!is_sync_kiocb(iocb) && 
(offset + count > i_size) &&
48d8dc19 Omar Sandoval 2015-03-16  2838 iov_iter_rw(iter) == WRITE)
4273b793 Anand Avati   2012-02-17  2839  
9d5722b7 Christoph Hellwig 2015-02-02  2840 if (io->async && 
is_sync_kiocb(iocb))
9d5722b7 Christoph Hellwig 2015-02-02  2841 io->done = &wait;
9d5722b7 Christoph Hellwig 2015-02-02  2842  
48d8dc19 Omar Sandoval 2015-03-16  2843 if (iov_iter_rw(iter) == WRITE) 
{
d04cfe78 Al Viro   2015-04-04  2844 ret = 
generic_write_checks(file, &pos, &count);
54c0874f Al Viro   2015-03-30  2845 if (!ret) {

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [next:master 7424/7993] drivers/target/target_core_sbc.c:696 sbc_check_prot() error: we previously assumed 'is_write' could be null (see line 683)

2015-04-05 Thread kbuild test robot
TO: Nicholas Bellinger 

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b448f49ac6731dc0dcda6848b696c49785a6b65f
commit: d55a67f12377164a568f62f5e7676277fee15b40 [7424/7993] target: Add 
protected fabric + unprotected device support
:: branch date: 5 days ago
:: commit date: 8 days ago

drivers/target/target_core_sbc.c:696 sbc_check_prot() error: we previously 
assumed 'is_write' could be null (see line 683)

git remote add next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update next
git checkout d55a67f12377164a568f62f5e7676277fee15b40
vim +/is_write +696 drivers/target/target_core_sbc.c

499bf77b0 Nicholas Bellinger 2013-12-23  677case TARGET_DIF_TYPE0_PROT:
d55a67f12 Nicholas Bellinger 2015-02-27  678/*
d55a67f12 Nicholas Bellinger 2015-02-27  679 * See if the fabric 
supports T10-PI, and the session has been
d55a67f12 Nicholas Bellinger 2015-02-27  680 * configured to allow 
export PROTECT=1 feature bit with backend
d55a67f12 Nicholas Bellinger 2015-02-27  681 * devices that don't 
support T10-PI.
d55a67f12 Nicholas Bellinger 2015-02-27  682 */
d55a67f12 Nicholas Bellinger 2015-02-27 @683fabric_prot = is_write ?
d55a67f12 Nicholas Bellinger 2015-02-27  684  (sp_ops & 
(TARGET_PROT_DOUT_PASS | TARGET_PROT_DOUT_STRIP)) :
d55a67f12 Nicholas Bellinger 2015-02-27  685  (sp_ops & 
(TARGET_PROT_DIN_PASS | TARGET_PROT_DIN_INSERT));
d55a67f12 Nicholas Bellinger 2015-02-27  686  
d55a67f12 Nicholas Bellinger 2015-02-27  687if (fabric_prot && 
cmd->se_sess->sess_prot_type) {
d55a67f12 Nicholas Bellinger 2015-02-27  688pi_prot_type = 
cmd->se_sess->sess_prot_type;
d55a67f12 Nicholas Bellinger 2015-02-27  689break;
d55a67f12 Nicholas Bellinger 2015-02-27  690}
d55a67f12 Nicholas Bellinger 2015-02-27  691/* Fallthrough */
499bf77b0 Nicholas Bellinger 2013-12-23  692default:
f7b7c06f3 Nicholas Bellinger 2015-02-13  693return TCM_NO_SENSE;
499bf77b0 Nicholas Bellinger 2013-12-23  694}
499bf77b0 Nicholas Bellinger 2013-12-23  695  
d55a67f12 Nicholas Bellinger 2015-02-27 @696if 
(sbc_set_prot_op_checks(protect, fabric_prot, pi_prot_type, is_write, cmd))
f7b7c06f3 Nicholas Bellinger 2015-02-13  697return 
TCM_INVALID_CDB_FIELD;
19f9361af Sagi Grimberg  2014-02-19  698  
d55a67f12 Nicholas Bellinger 2015-02-27  699cmd->prot_type = pi_prot_type;

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [next:master 2183/8741] drivers/platform/x86/thinkpad_acpi.c:3683 adaptive_keyboard_hotkey_notify_hotkey() error: buffer overflow 'hotkey_keycode_map' 32 <= 52

2015-04-05 Thread kbuild test robot
TO: Bastien Nocera 
CC: Darren Hart 

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b0a12fb5bc87820b12df22c64dd680a96443de00
commit: 6a68d855708497c542d57a82a5f8e3a513a65a82 [2183/8741] thinkpad_acpi: Add 
support for more adaptive kbd buttons
:: branch date: 3 days ago
:: commit date: 5 weeks ago

New smatch warnings:
drivers/platform/x86/thinkpad_acpi.c:3683 
adaptive_keyboard_hotkey_notify_hotkey() error: buffer overflow 
'hotkey_keycode_map' 32 <= 52

Old smatch warnings:
drivers/platform/x86/thinkpad_acpi.c:2962 adaptive_kbd_mode_show() warn: 
unsigned 'current_mode' is never less than zero.
drivers/platform/x86/thinkpad_acpi.c:3653 
adaptive_keyboard_hotkey_notify_hotkey() warn: unsigned 'current_mode' is never 
less than zero.
drivers/platform/x86/thinkpad_acpi.c:3666 
adaptive_keyboard_hotkey_notify_hotkey() warn: unsigned 'current_mode' is never 
less than zero.

git remote add next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update next
git checkout 6a68d855708497c542d57a82a5f8e3a513a65a82
vim +/hotkey_keycode_map +3683 drivers/platform/x86/thinkpad_acpi.c

3a9d20bd Shuduo Sang2014-03-06  3667return false;
f74587fb Bastien Nocera 2015-03-02  3668  
f74587fb Bastien Nocera 2015-03-02  3669
adaptive_keyboard_prev_mode = current_mode;
3a9d20bd Shuduo Sang2014-03-06  3670
adaptive_keyboard_mode_is_saved = true;
3a9d20bd Shuduo Sang2014-03-06  3671  
f74587fb Bastien Nocera 2015-03-02  3672if 
(adaptive_keyboard_set_mode (FUNCTION_MODE) < 0)
3a9d20bd Shuduo Sang2014-03-06  3673return false;
3a9d20bd Shuduo Sang2014-03-06  3674return true;
3a9d20bd Shuduo Sang2014-03-06  3675  
3a9d20bd Shuduo Sang2014-03-06  3676default:
6a68d855 Bastien Nocera 2015-03-02  3677if (scancode < 
FIRST_ADAPTIVE_KEY || scancode > FIRST_ADAPTIVE_KEY +
6a68d855 Bastien Nocera 2015-03-02  3678
TPACPI_HOTKEY_MAP_LEN - ADAPTIVE_KEY_OFFSET) {
6a68d855 Bastien Nocera 2015-03-02  3679
pr_info("Unhandled adaptive keyboard key: 0x%x\n",
6a68d855 Bastien Nocera 2015-03-02  3680
scancode);
3a9d20bd Shuduo Sang2014-03-06  3681return false;
3a9d20bd Shuduo Sang2014-03-06  3682}
6a68d855 Bastien Nocera 2015-03-02 @3683keycode = 
hotkey_keycode_map[scancode - FIRST_ADAPTIVE_KEY + ADAPTIVE_KEY_OFFSET];
6a68d855 Bastien Nocera 2015-03-02  3684if (keycode != 
KEY_RESERVED) {
6a68d855 Bastien Nocera 2015-03-02  3685
mutex_lock(&tpacpi_inputdev_send_mutex);
6a68d855 Bastien Nocera 2015-03-02  3686  
6a68d855 Bastien Nocera 2015-03-02  3687
input_report_key(tpacpi_inputdev, keycode, 1);
6a68d855 Bastien Nocera 2015-03-02  3688
input_sync(tpacpi_inputdev);
6a68d855 Bastien Nocera 2015-03-02  3689  
6a68d855 Bastien Nocera 2015-03-02  3690
input_report_key(tpacpi_inputdev, keycode, 0);
6a68d855 Bastien Nocera 2015-03-02  3691
input_sync(tpacpi_inputdev);

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [linuxtv-media:master 331/653] drivers/media/dvb-core/dvbdev.c:270 dvb_register_device() error: __builtin_memcpy() 'template' too small (96 vs 104)

2015-04-05 Thread kbuild test robot
TO: Mauro Carvalho Chehab 
CC: linux-me...@vger.kernel.org

tree:   git://linuxtv.org/media_tree.git master
head:   a5562f65b1371a0988b707c10c44fcc2bba56990
commit: a0246e02f466482a34c8ad94bedbe4efa498662d [331/653] [media] dvbdev: add 
support for media controller
:: branch date: 3 days ago
:: commit date: 7 weeks ago

drivers/media/dvb-core/dvbdev.c:270 dvb_register_device() error: 
__builtin_memcpy() 'template' too small (96 vs 104)

git remote add linuxtv-media git://linuxtv.org/media_tree.git
git remote update linuxtv-media
git checkout a0246e02f466482a34c8ad94bedbe4efa498662d
vim +/template +270 drivers/media/dvb-core/dvbdev.c

^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  254  
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  255  
*pdvbdev = dvbdev = kmalloc(sizeof(struct dvb_device), GFP_KERNEL);
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  256  
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  257  
if (!dvbdev){
1e4baed3 drivers/media/dvb/dvb-core/dvbdev.c Ingo Molnar   2006-01-15  258  
mutex_unlock(&dvbdev_register_lock);
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  259  
return -ENOMEM;
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  260  
}
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  261  
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  262  
dvbdevfops = kzalloc(sizeof(struct file_operations), GFP_KERNEL);
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  263  
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  264  
if (!dvbdevfops){
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  265  
kfree (dvbdev);
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  266  
mutex_unlock(&dvbdev_register_lock);
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  267  
return -ENOMEM;
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  268  
}
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  269  
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16 @270  
memcpy(dvbdev, template, sizeof(struct dvb_device));
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  271  
dvbdev->type = type;
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  272  
dvbdev->id = id;
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  273  
dvbdev->adapter = adap;
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  274  
dvbdev->priv = priv;
b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  275  
dvbdev->fops = dvbdevfops;
ca5be9cd drivers/media/dvb/dvb-core/dvbdev.c Markus Rechberger 2007-04-14  276  
init_waitqueue_head (&dvbdev->wait_queue);
^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  277  
784e29d2 drivers/media/dvb/dvb-core/dvbdev.c Jan Engelhardt2009-01-11  278  
memcpy(dvbdevfops, template->fops, sizeof(struct file_operations));

:: The code at line 270 was first introduced by commit
:: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:: TO: Linus Torvalds 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [next:master 6253/8741] fs/xfs/xfs_inode.c:2914 xfs_rename() warn: variable dereferenced before check 'wip' (see line 2874)

2015-04-05 Thread kbuild test robot
TO: Dave Chinner 

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b0a12fb5bc87820b12df22c64dd680a96443de00
commit: 7dcf5c3e4527cfa2807567b00387cf2ed5e07f00 [6253/8741] xfs: add 
RENAME_WHITEOUT support
:: branch date: 3 days ago
:: commit date: 12 days ago

New smatch warnings:
fs/xfs/xfs_inode.c:2914 xfs_rename() warn: variable dereferenced before check 
'wip' (see line 2874)

Old smatch warnings:
fs/xfs/xfs_inode.c:357 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:359 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:381 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:387 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:401 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:2932 xfs_rename() error: we previously assumed 'target_ip' 
could be null (see line 2912)

git remote add next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update next
git checkout 7dcf5c3e4527cfa2807567b00387cf2ed5e07f00
vim +/wip +2914 fs/xfs/xfs_inode.c

7dcf5c3e Dave Chinner 2015-03-25  2868  return error;
7dcf5c3e Dave Chinner 2015-03-25  2869  
7dcf5c3e Dave Chinner 2015-03-25  2870  /* setup target dirent 
info as whiteout */
7dcf5c3e Dave Chinner 2015-03-25  2871  src_name->type = 
XFS_DIR3_FT_CHRDEV;
7dcf5c3e Dave Chinner 2015-03-25  2872  }
f6bba201 Dave Chinner 2013-08-12  2873  
7dcf5c3e Dave Chinner 2015-03-25 @2874  xfs_sort_for_rename(src_dp, 
target_dp, src_ip, target_ip, wip,
f6bba201 Dave Chinner 2013-08-12  2875  inodes, 
&num_inodes);
f6bba201 Dave Chinner 2013-08-12  2876  
f6bba201 Dave Chinner 2013-08-12  2877  tp = xfs_trans_alloc(mp, 
XFS_TRANS_RENAME);
f6bba201 Dave Chinner 2013-08-12  2878  spaceres = 
XFS_RENAME_SPACE_RES(mp, target_name->len);
3d3c8b52 Jie Liu  2013-08-12  2879  error = xfs_trans_reserve(tp, 
&M_RES(mp)->tr_rename, spaceres, 0);
2451337d Dave Chinner 2014-06-25  2880  if (error == -ENOSPC) {
f6bba201 Dave Chinner 2013-08-12  2881  spaceres = 0;
3d3c8b52 Jie Liu  2013-08-12  2882  error = 
xfs_trans_reserve(tp, &M_RES(mp)->tr_rename, 0, 0);
f6bba201 Dave Chinner 2013-08-12  2883  }
445883e8 Dave Chinner 2015-03-25  2884  if (error)
445883e8 Dave Chinner 2015-03-25  2885  goto out_trans_cancel;
445883e8 Dave Chinner 2015-03-25  2886  cancel_flags = 
XFS_TRANS_RELEASE_LOG_RES;
f6bba201 Dave Chinner 2013-08-12  2887  
f6bba201 Dave Chinner 2013-08-12  2888  /*
f6bba201 Dave Chinner 2013-08-12  2889   * Attach the dquots to the 
inodes
f6bba201 Dave Chinner 2013-08-12  2890   */
f6bba201 Dave Chinner 2013-08-12  2891  error = 
xfs_qm_vop_rename_dqattach(inodes);
445883e8 Dave Chinner 2015-03-25  2892  if (error)
445883e8 Dave Chinner 2015-03-25  2893  goto out_trans_cancel;
f6bba201 Dave Chinner 2013-08-12  2894  
f6bba201 Dave Chinner 2013-08-12  2895  /*
f6bba201 Dave Chinner 2013-08-12  2896   * Lock all the participating 
inodes. Depending upon whether
f6bba201 Dave Chinner 2013-08-12  2897   * the target_name exists in 
the target directory, and
f6bba201 Dave Chinner 2013-08-12  2898   * whether the target directory 
is the same as the source
f6bba201 Dave Chinner 2013-08-12  2899   * directory, we can lock from 
2 to 4 inodes.
f6bba201 Dave Chinner 2013-08-12  2900   */
f6bba201 Dave Chinner 2013-08-12  2901  xfs_lock_inodes(inodes, 
num_inodes, XFS_ILOCK_EXCL);
f6bba201 Dave Chinner 2013-08-12  2902  
f6bba201 Dave Chinner 2013-08-12  2903  /*
f6bba201 Dave Chinner 2013-08-12  2904   * Join all the inodes to the 
transaction. From this point on,
f6bba201 Dave Chinner 2013-08-12  2905   * we can rely on either 
trans_commit or trans_cancel to unlock
f6bba201 Dave Chinner 2013-08-12  2906   * them.
f6bba201 Dave Chinner 2013-08-12  2907   */
f6bba201 Dave Chinner 2013-08-12  2908  xfs_trans_ijoin(tp, src_dp, 
XFS_ILOCK_EXCL);
f6bba201 Dave Chinner 2013-08-12  2909  if (new_parent)
f6bba201 Dave Chinner 2013-08-12  2910  xfs_trans_ijoin(tp, 
target_dp, XFS_ILOCK_EXCL);
f6bba201 Dave Chinner 2013-08-12  2911  xfs_trans_ijoin(tp, src_ip, 
XFS_ILOCK_EXCL);
f6bba201 Dave Chinner 2013-08-12  2912  if (target_ip)
f6bba201 Dave Chinner 2013-08-12  2913  xfs_trans_ijoin(tp, 
target_ip, XFS_ILOCK_EXCL);
7dcf5c3e Dave Chinner 2015-03-25 @2914  if (wip)
7dcf5c3e Dave Chinner 2015-03-25  2915  xfs_trans_ijoin(tp, 
wip, XFS_ILOCK_EXCL);
f6bba201 Dave Chinner 2013-08-12  2916  
f6bba201 Dave Chinner 2013-08-12  2917  /*

---
0-DAY kernel test infras

[kbuild] [next:master 6249/8741] fs/xfs/xfs_inode.c:357 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4

2015-04-05 Thread kbuild test robot
TO: Dave Chinner 

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b0a12fb5bc87820b12df22c64dd680a96443de00
commit: 95afcf5c7bca93fb84d260f70c304f35ef4c3114 [6249/8741] xfs: clean up 
inode locking for RENAME_WHITEOUT
:: branch date: 3 days ago
:: commit date: 12 days ago

New smatch warnings:
fs/xfs/xfs_inode.c:357 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:359 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:381 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:387 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4
fs/xfs/xfs_inode.c:401 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4

Old smatch warnings:
fs/xfs/xfs_inode.c:2863 xfs_rename() error: we previously assumed 'target_ip' 
could be null (see line 2845)

git remote add next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update next
git checkout 95afcf5c7bca93fb84d260f70c304f35ef4c3114
vim +/ips +357 fs/xfs/xfs_inode.c

95afcf5c Dave Chinner 2015-03-25  351   ASSERT(ips && inodes >= 2 && inodes <= 
5);
c24b5dfa Dave Chinner 2013-08-12  352  
c24b5dfa Dave Chinner 2013-08-12  353   try_lock = 0;
c24b5dfa Dave Chinner 2013-08-12  354   i = 0;
c24b5dfa Dave Chinner 2013-08-12  355  again:
c24b5dfa Dave Chinner 2013-08-12  356   for (; i < inodes; i++) {
c24b5dfa Dave Chinner 2013-08-12 @357   ASSERT(ips[i]);
c24b5dfa Dave Chinner 2013-08-12  358  
c24b5dfa Dave Chinner 2013-08-12 @359   if (i && (ips[i] == ips[i - 
1]))/* Already locked */
c24b5dfa Dave Chinner 2013-08-12  360   continue;
c24b5dfa Dave Chinner 2013-08-12  361  
c24b5dfa Dave Chinner 2013-08-12  362   /*
95afcf5c Dave Chinner 2015-03-25  363* If try_lock is not set yet, 
make sure all locked inodes are
95afcf5c Dave Chinner 2015-03-25  364* not in the AIL.  If any are, 
set try_lock to be used later.
c24b5dfa Dave Chinner 2013-08-12  365*/
c24b5dfa Dave Chinner 2013-08-12  366   if (!try_lock) {
c24b5dfa Dave Chinner 2013-08-12  367   for (j = (i - 1); j >= 
0 && !try_lock; j--) {
c24b5dfa Dave Chinner 2013-08-12  368   lp = 
(xfs_log_item_t *)ips[j]->i_itemp;
95afcf5c Dave Chinner 2015-03-25  369   if (lp && 
(lp->li_flags & XFS_LI_IN_AIL))
c24b5dfa Dave Chinner 2013-08-12  370   
try_lock++;
c24b5dfa Dave Chinner 2013-08-12  371   }
c24b5dfa Dave Chinner 2013-08-12  372   }
c24b5dfa Dave Chinner 2013-08-12  373  
c24b5dfa Dave Chinner 2013-08-12  374   /*
c24b5dfa Dave Chinner 2013-08-12  375* If any of the previous locks 
we have locked is in the AIL,
c24b5dfa Dave Chinner 2013-08-12  376* we must TRY to get the 
second and subsequent locks. If
c24b5dfa Dave Chinner 2013-08-12  377* we can't get any, we must 
release all we have
c24b5dfa Dave Chinner 2013-08-12  378* and try again.
c24b5dfa Dave Chinner 2013-08-12  379*/
95afcf5c Dave Chinner 2015-03-25  380   if (!try_lock) {
95afcf5c Dave Chinner 2015-03-25 @381   xfs_ilock(ips[i], 
xfs_lock_inumorder(lock_mode, i));
95afcf5c Dave Chinner 2015-03-25  382   continue;
95afcf5c Dave Chinner 2015-03-25  383   }
c24b5dfa Dave Chinner 2013-08-12  384  
95afcf5c Dave Chinner 2015-03-25  385   /* try_lock means we have an 
inode locked that is in the AIL. */
c24b5dfa Dave Chinner 2013-08-12  386   ASSERT(i != 0);
95afcf5c Dave Chinner 2015-03-25 @387   if (xfs_ilock_nowait(ips[i], 
xfs_lock_inumorder(lock_mode, i)))
95afcf5c Dave Chinner 2015-03-25  388   continue;
c24b5dfa Dave Chinner 2013-08-12  389  
c24b5dfa Dave Chinner 2013-08-12  390   /*
95afcf5c Dave Chinner 2015-03-25  391* Unlock all previous guys and 
try again.  xfs_iunlock will try
95afcf5c Dave Chinner 2015-03-25  392* to push the tail if the 
inode is in the AIL.
c24b5dfa Dave Chinner 2013-08-12  393*/
95afcf5c Dave Chinner 2015-03-25  394   attempts++;
c24b5dfa Dave Chinner 2013-08-12  395   for (j = i - 1; j >= 0; j--) {
c24b5dfa Dave Chinner 2013-08-12  396   /*
95afcf5c Dave Chinner 2015-03-25  397* Check to see if 
we've already unlocked this one.  Not
95afcf5c Dave Chinner 2015-03-25  398* the first one going 
back, and the inode ptr is the
95afcf5c Dave Chinner 2015-03-25  399* same.
c24b5dfa Dave Chinner 2013-08-12  400*/
95afcf5c Dave Chinner 2015-03-25 @401   if (j != (i - 1) && 
ips[j] == ips[j + 1])
c24b5dfa Dave Chinner 2013-08-12  402   continue;
c24b5dfa Dave Chinner 2013-08-12  403  
c24b5dfa Dave Chinner 2013-08-12  404 

[kbuild] [robclark:integration-linux-qcomlt-drm-rebase 0/1] drivers/thermal/msm8960_tsens.c:218 tsens_set_mode() warn: variable dereferenced before check 'tm_sensor' (see line 213)

2015-04-05 Thread kbuild test robot
TO: Srinivas Kandagatla 

tree:   git://people.freedesktop.org/~robclark/linux 
integration-linux-qcomlt-drm-rebase
head:   e92f5455bd17e46fc475792dfff3378d160ec81e
commit: 5b1d3dec8f4dea54ea833bcbfba85d6b90a92f5f [0/1] Merge branch 
'tracking-qcomlt-efuse' into integration-linux-qcomlt
:: branch date: 8 days ago
:: commit date: 2 weeks ago

drivers/thermal/msm8960_tsens.c:218 tsens_set_mode() warn: variable 
dereferenced before check 'tm_sensor' (see line 213)
drivers/thermal/msm8960_tsens.c:286 tsens_get_trip_temp() warn: variable 
dereferenced before check 'tm_sensor' (see line 283)
drivers/thermal/msm8960_tsens.c:328 tsens_set_trip_temp() warn: variable 
dereferenced before check 'tm_sensor' (see line 322)

git remote add robclark git://people.freedesktop.org/~robclark/linux
git remote update robclark
git checkout 5b1d3dec8f4dea54ea833bcbfba85d6b90a92f5f
vim +/tm_sensor +218 drivers/thermal/msm8960_tsens.c

d63cd69b Srinivas Kandagatla 2015-01-22  207   **/
d63cd69b Srinivas Kandagatla 2015-01-22  208  
d63cd69b Srinivas Kandagatla 2015-01-22  209  static int tsens_set_mode(struct 
thermal_zone_device *thermal,
d63cd69b Srinivas Kandagatla 2015-01-22  210  enum 
thermal_device_mode mode)
d63cd69b Srinivas Kandagatla 2015-01-22  211  {
d63cd69b Srinivas Kandagatla 2015-01-22  212struct tsens_tm_device_sensor 
*tm_sensor = thermal->devdata;
d63cd69b Srinivas Kandagatla 2015-01-22 @213struct tsens_tm_device *tmdev = 
tm_sensor->tmdev;
d63cd69b Srinivas Kandagatla 2015-01-22  214struct tsens_variant_data *data 
= tmdev->data;
d63cd69b Srinivas Kandagatla 2015-01-22  215struct regmap *base = 
tmdev->base;
d63cd69b Srinivas Kandagatla 2015-01-22  216unsigned int reg, mask, i;
d63cd69b Srinivas Kandagatla 2015-01-22  217  
d63cd69b Srinivas Kandagatla 2015-01-22 @218if (!tm_sensor)
d63cd69b Srinivas Kandagatla 2015-01-22  219return -EINVAL;
d63cd69b Srinivas Kandagatla 2015-01-22  220  
d63cd69b Srinivas Kandagatla 2015-01-22  221if (mode != tm_sensor->mode) {
d63cd69b Srinivas Kandagatla 2015-01-22  222regmap_read(base, 
TSENS_CNTL_ADDR, ®);
d63cd69b Srinivas Kandagatla 2015-01-22  223mask = 
BIT(tm_sensor->sensor_num + TSENS_SENSOR0_SHIFT);
d63cd69b Srinivas Kandagatla 2015-01-22  224if (mode == 
THERMAL_DEVICE_ENABLED) {
d63cd69b Srinivas Kandagatla 2015-01-22  225if ((mask != 
SENSOR0_EN) && !(reg & SENSOR0_EN)) {
d63cd69b Srinivas Kandagatla 2015-01-22  226
pr_info("Main sensor not enabled\n");
d63cd69b Srinivas Kandagatla 2015-01-22  227return 
-EINVAL;
d63cd69b Srinivas Kandagatla 2015-01-22  228}
d63cd69b Srinivas Kandagatla 2015-01-22  229
regmap_write(base, TSENS_CNTL_ADDR, reg | TSENS_SW_RST);
d63cd69b Srinivas Kandagatla 2015-01-22  230reg |= mask | 
data->slp_clk_ena | TSENS_EN;
d63cd69b Srinivas Kandagatla 2015-01-22  231tmdev->trdy = 
false;
d63cd69b Srinivas Kandagatla 2015-01-22  232} else {
d63cd69b Srinivas Kandagatla 2015-01-22  233reg &= ~mask;
d63cd69b Srinivas Kandagatla 2015-01-22  234if (!(reg & 
SENSOR0_EN)) {
d63cd69b Srinivas Kandagatla 2015-01-22  235reg &= 
~(SENSORS_EN_MASK(tmdev->nsensors) |
d63cd69b Srinivas Kandagatla 2015-01-22  236
data->slp_clk_ena |
d63cd69b Srinivas Kandagatla 2015-01-22  237
TSENS_EN);
d63cd69b Srinivas Kandagatla 2015-01-22  238  
d63cd69b Srinivas Kandagatla 2015-01-22  239for (i 
= 1; i < tmdev->nsensors; i++)
d63cd69b Srinivas Kandagatla 2015-01-22  240
tmdev->sensor[i].mode = mode;
d63cd69b Srinivas Kandagatla 2015-01-22  241  
d63cd69b Srinivas Kandagatla 2015-01-22  242}
d63cd69b Srinivas Kandagatla 2015-01-22  243}
d63cd69b Srinivas Kandagatla 2015-01-22  244regmap_write(base, 
TSENS_CNTL_ADDR, reg);
d63cd69b Srinivas Kandagatla 2015-01-22  245}
d63cd69b Srinivas Kandagatla 2015-01-22  246tm_sensor->mode = mode;
d63cd69b Srinivas Kandagatla 2015-01-22  247  
d63cd69b Srinivas Kandagatla 2015-01-22  248return 0;
d63cd69b Srinivas Kandagatla 2015-01-22  249  }
d63cd69b Srinivas Kandagatla 2015-01-22  250  
d63cd69b Srinivas Kandagatla 2015-01-22  251  static int 
tsens_get_trip_type(struct thermal_zone_device *thermal,
d63cd69b Srinivas Kandagatla 2015-01-22  252   int 
trip, enum thermal_trip_type *type)
d63cd69b Srinivas Kandagatla 2015-01-22  253  {
d63cd69b Srinivas Kandagatla 2015-01-22  254struct tsens_tm_device_sensor 
*tm_sensor = thermal->devdata;
d63cd69b Srinivas Kandagatla 2015-01-22  255  
d63cd69b Srinivas Kandagatla 2015-01-22  256if (!tm_sensor || trip < 0 || 
!type)
d63