[kbuild] [PATCH] i2c-i801: fix returnvar.cocci warnings

2015-04-07 Thread kbuild test robot
TO: Corey Minyard 

drivers/i2c/busses/i2c-i801.c:614:5-11: Unneeded variable: "result". Return "0" 
on line 647


 Removes unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Signed-off-by: Fengguang Wu 
---

Please take the patch only if it's a positive warning. Thanks!

 i2c-i801.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -611,8 +611,6 @@ static int i801_set_block_buffer_mode(st
 static int i801_block_transaction(struct i801_priv *priv,
  int command, int hwpec)
 {
-   int result = 0;
-
if (!priv->is_read || command == I2C_SMBUS_I2C_BLOCK_DATA) {
if (priv->data->block[0] < 1)
priv->data->block[0] = 1;
@@ -644,7 +642,7 @@ static int i801_block_transaction(struct
i801_block_transaction_byte_by_byte(priv, command);
}
 
-   return result;
+   return 0;
 }
 
 static s32 i801_setup(struct i801_priv *priv, u16 addr, u8 command, int size)
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


Re: [kbuild] [char-misc:char-misc-testing 112/125] drivers/hv/channel_mgmt.c:217 vmbus_free_channels() error: dereferencing freed memory 'channel'

2015-04-07 Thread Dan Carpenter
On Tue, Apr 07, 2015 at 11:27:39AM +, Dexuan Cui wrote:
> Hi Dan,
> Thanks a lot for finding this issue!
> BTW, did you find this by some auto-analyzing tool?

This is a Smatch warning.  http://smatch.sf.net

> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -215,8 +215,12 @@ void vmbus_free_channels(void)
> struct vmbus_channel *channel;
> 
> list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {

I was expecting that we should just use list_for_each_entry_safe()
instead.

regards,
dan carpenter

___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


Re: [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-07 Thread Dan Carpenter
Database out of sync I think.  I should probably silence this one though
because is_write is a bool so obviously this warning makes no sense.

regards,
dan carpenter

On Mon, Apr 06, 2015 at 01:03:08AM +0800, kbuild test robot wrote:
> 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  677  case 
> 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 @683  fabric_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  687  if (fabric_prot 
> && cmd->se_sess->sess_prot_type) {
> d55a67f12 Nicholas Bellinger 2015-02-27  688  
> pi_prot_type = cmd->se_sess->sess_prot_type;
> d55a67f12 Nicholas Bellinger 2015-02-27  689  break;
> d55a67f12 Nicholas Bellinger 2015-02-27  690  }
> d55a67f12 Nicholas Bellinger 2015-02-27  691  /* Fallthrough 
> */
> 499bf77b0 Nicholas Bellinger 2013-12-23  692  default:
> f7b7c06f3 Nicholas Bellinger 2015-02-13  693  return 
> TCM_NO_SENSE;
> 499bf77b0 Nicholas Bellinger 2013-12-23  694  }
> 499bf77b0 Nicholas Bellinger 2013-12-23  695  
> d55a67f12 Nicholas Bellinger 2015-02-27 @696  if 
> (sbc_set_prot_op_checks(protect, fabric_prot, pi_prot_type, is_write, cmd))
> f7b7c06f3 Nicholas Bellinger 2015-02-13  697  return 
> TCM_INVALID_CDB_FIELD;
> 19f9361af Sagi Grimberg  2014-02-19  698  
> d55a67f12 Nicholas Bellinger 2015-02-27  699  cmd->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


Re: [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-07 Thread Dan Carpenter
I sent a patch for this already.

regards,
dan carpenter

On Mon, Apr 06, 2015 at 12:41:13AM +0800, kbuild test robot wrote:
> 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  3667  return 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  3672  if 
> (adaptive_keyboard_set_mode (FUNCTION_MODE) < 0)
> 3a9d20bd Shuduo Sang2014-03-06  3673  return false;
> 3a9d20bd Shuduo Sang2014-03-06  3674  return true;
> 3a9d20bd Shuduo Sang2014-03-06  3675  
> 3a9d20bd Shuduo Sang2014-03-06  3676  default:
> 6a68d855 Bastien Nocera 2015-03-02  3677  if (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  3681  return false;
> 3a9d20bd Shuduo Sang2014-03-06  3682  }
> 6a68d855 Bastien Nocera 2015-03-02 @3683  keycode = 
> hotkey_keycode_map[scancode - FIRST_ADAPTIVE_KEY + ADAPTIVE_KEY_OFFSET];
> 6a68d855 Bastien Nocera 2015-03-02  3684  if (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


Re: [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-07 Thread Dan Carpenter
False positive.  I tried to fix this before but my patch caused random
segfaults and I gave up.  I should look again.  Sorry.

regards,
dan carpenter

On Mon, Apr 06, 2015 at 12:17:38AM +0800, kbuild test robot wrote:
> 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  
> 257if (!dvbdev){
> 1e4baed3 drivers/media/dvb/dvb-core/dvbdev.c Ingo Molnar   2006-01-15  
> 258mutex_unlock(&dvbdev_register_lock);
> ^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  
> 259return -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  
> 262dvbdevfops = 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  
> 264if (!dvbdevfops){
> b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  
> 265kfree (dvbdev);
> b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  
> 266mutex_unlock(&dvbdev_register_lock);
> b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  
> 267return -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 
> @270memcpy(dvbdev, template, sizeof(struct dvb_device));
> ^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  
> 271dvbdev->type = type;
> ^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  
> 272dvbdev->id = id;
> ^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  
> 273dvbdev->adapter = adap;
> ^1da177e drivers/media/dvb/dvb-core/dvbdev.c Linus Torvalds2005-04-16  
> 274dvbdev->priv = priv;
> b6190102 drivers/media/dvb/dvb-core/dvbdev.c Marcel Siegert2007-02-13  
> 275dvbdev->fops = dvbdevfops;
> ca5be9cd drivers/media/dvb/dvb-core/dvbdev.c Markus Rechberger 2007-04-14  
> 276init_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  
> 278memcpy(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


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

2015-04-07 Thread Dan Carpenter
False positive.  Cross function database slightly out of sync.

regards,
dan carpenter

On Sun, Apr 05, 2015 at 11:45:08PM +0800, kbuild test robot wrote:
> 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  2868return 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  2871src_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 @2874xfs_sort_for_rename(src_dp, 
> target_dp, src_ip, target_ip, wip,
> f6bba201 Dave Chinner 2013-08-12  2875inodes, 
> &num_inodes);
> f6bba201 Dave Chinner 2013-08-12  2876  
> f6bba201 Dave Chinner 2013-08-12  2877tp = xfs_trans_alloc(mp, 
> XFS_TRANS_RENAME);
> f6bba201 Dave Chinner 2013-08-12  2878spaceres = 
> XFS_RENAME_SPACE_RES(mp, target_name->len);
> 3d3c8b52 Jie Liu  2013-08-12  2879error = xfs_trans_reserve(tp, 
> &M_RES(mp)->tr_rename, spaceres, 0);
> 2451337d Dave Chinner 2014-06-25  2880if (error == -ENOSPC) {
> f6bba201 Dave Chinner 2013-08-12  2881spaceres = 0;
> 3d3c8b52 Jie Liu  2013-08-12  2882error = 
> xfs_trans_reserve(tp, &M_RES(mp)->tr_rename, 0, 0);
> f6bba201 Dave Chinner 2013-08-12  2883}
> 445883e8 Dave Chinner 2015-03-25  2884if (error)
> 445883e8 Dave Chinner 2015-03-25  2885goto out_trans_cancel;
> 445883e8 Dave Chinner 2015-03-25  2886cancel_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  2891error = 
> xfs_qm_vop_rename_dqattach(inodes);
> 445883e8 Dave Chinner 2015-03-25  2892if (error)
> 445883e8 Dave Chinner 2015-03-25  2893goto 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  2901xfs_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  2908xfs_trans_ijoin(tp, src_dp, 
> XFS_ILOCK_EXCL);
> f6bba201 Dave Chinner 2013-08-12  2909if (new_parent)
> f6bba201 Dave Chinner 2013-08-12  2910xfs_trans_ijoin(tp, 
> target_dp, XFS_ILOCK_EXCL);
> f6bba201 Dave Chinner 2013-08-12  2911xfs_trans_ijoin(tp, src_ip, 
> XFS_ILOCK_EXCL);
> f6bba201 Dave Chinner 2013-08-12  2912if (target_ip)
> f6bba201 Dave Chinner 2013-08-12  2913xfs_trans_ijoin(tp, 
> target_ip, XFS_ILOCK_EXCL);
> 7dcf5

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

2015-04-07 Thread Dan Carpenter
False positive.  The cross database was slightly out of sync.

regards,
dan carpenter


On Sun, Apr 05, 2015 at 11:16:54PM +0800, kbuild test robot wrote:
> 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   

[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-07 Thread Dan Carpenter
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

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)
d63cd69b Srinivas Kandagatla 2015-01-22  257return -EINVAL;
d63cd69b Srinivas Ka

Re: [kbuild] [usb-serial:usb-next 9/12] drivers/usb/serial/f81232.c:615 f81232_get_serial_info() warn: check that 'ser' doesn't leak information (struct has a hole after 'iomem_reg_shift')

2015-04-07 Thread Dan Carpenter
False positive.  I haven't looked at the pre-compiled but I'm guessing
that this is because it was calling __builtin_memset().  I've added that
now so hopefully it won't happen again.

regards,
dan carpenter

On Sat, Mar 28, 2015 at 02:00:33AM +0800, kbuild test robot wrote:
> TO: Peter Hung 
> CC: Johan Hovold 
> 
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git 
> usb-next
> head:   65dd82ae453f5290be0ea83ed0f23163ea49c0eb
> commit: 88d35c83cc0b11d6e7a2bef73b602f156da0 [9/12] USB: f81232: clarify 
> f81232_ioctl() and fix
> :: branch date: 84 minutes ago
> :: commit date: 2 hours ago
> 
> drivers/usb/serial/f81232.c:615 f81232_get_serial_info() warn: check that 
> 'ser' doesn't leak information (struct has a hole after 'iomem_reg_shift')
> 
> git remote add usb-serial 
> git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git
> git remote update usb-serial
> git checkout 88d35c83cc0b11d6e7a2bef73b602f156da0
> vim +615 drivers/usb/serial/f81232.c
> 
> aac1fc38 Greg Kroah-Hartman 2012-02-28  599   return 1;
> aac1fc38 Greg Kroah-Hartman 2012-02-28  600   return 0;
> aac1fc38 Greg Kroah-Hartman 2012-02-28  601  }
> aac1fc38 Greg Kroah-Hartman 2012-02-28  602  
> 88d35cff Peter Hung 2015-03-17  603  static int 
> f81232_get_serial_info(struct usb_serial_port *port,
> 88d35cff Peter Hung 2015-03-17  604   unsigned long arg)
> aac1fc38 Greg Kroah-Hartman 2012-02-28  605  {
> aac1fc38 Greg Kroah-Hartman 2012-02-28  606   struct serial_struct ser;
> a94e9b94 Greg Kroah-Hartman 2012-05-15  607  
> 88d35cff Peter Hung 2015-03-17  608   memset(&ser, 0, sizeof(ser));
> 88d35cff Peter Hung 2015-03-17  609  
> 88d35cff Peter Hung 2015-03-17  610   ser.type = PORT_16550A;
> e5b1e206 Greg Kroah-Hartman 2013-06-07  611   ser.line = port->minor;
> 1143832e Greg Kroah-Hartman 2013-06-06  612   ser.port = port->port_number;
> 88d35cff Peter Hung 2015-03-17  613   ser.baud_base = 
> F81232_MAX_BAUDRATE;
> aac1fc38 Greg Kroah-Hartman 2012-02-28  614  
> 88d35cff Peter Hung 2015-03-17 @615   if (copy_to_user((void __user 
> *)arg, &ser, sizeof(ser)))
> aac1fc38 Greg Kroah-Hartman 2012-02-28  616   return -EFAULT;
> aac1fc38 Greg Kroah-Hartman 2012-02-28  617  
> aac1fc38 Greg Kroah-Hartman 2012-02-28  618   return 0;
> 88d35cff Peter Hung 2015-03-17  619  }
> 88d35cff Peter Hung 2015-03-17  620  
> 88d35cff Peter Hung 2015-03-17  621  static int f81232_ioctl(struct 
> tty_struct *tty,
> 88d35cff Peter Hung 2015-03-17  622   unsigned int 
> cmd, unsigned long arg)
> 88d35cff Peter Hung 2015-03-17  623  {
> 
> ---
> 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] [char-misc:char-misc-testing 112/125] drivers/hv/channel_mgmt.c:217 vmbus_free_channels() error: dereferencing freed memory 'channel'

2015-04-07 Thread Dan Carpenter
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 
char-misc-testing
head:   1ac4e6fee41d6534b6e54dcbed381590e242bdcb
commit: aadc3780f31865edc84c587ab718a33a8eeeb09d [112/125] hv: remove the 
per-channel workqueue

drivers/hv/channel_mgmt.c:217 vmbus_free_channels() error: dereferencing freed 
memory 'channel'

git remote add char-misc 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
git remote update char-misc
git checkout aadc3780f31865edc84c587ab718a33a8eeeb09d
vim +/channel +217 drivers/hv/channel_mgmt.c

c8705979 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2013-03-15  201 
spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
c8705979 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2013-03-15  202 
list_del(&channel->listentry);
c8705979 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2013-03-15  203 
spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
e68d2971 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2013-05-23  204 
} else {
e68d2971 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2013-05-23  205 
primary_channel = channel->primary_channel;
67fae053 drivers/hv/channel_mgmt.c Vitaly Kuznetsov 2015-01-20  206 
spin_lock_irqsave(&primary_channel->lock, flags);
565ce642 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2013-10-16  207 
list_del(&channel->sc_list);
67fae053 drivers/hv/channel_mgmt.c Vitaly Kuznetsov 2015-01-20  208 
spin_unlock_irqrestore(&primary_channel->lock, flags);
e68d2971 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2013-05-23  209 
}
c8705979 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2013-03-15  210 
free_channel(channel);
4b2f9abe drivers/staging/hv/channel_mgmt.c Timo Teräs   2010-12-15  211  }
8b5d6d3b drivers/staging/hv/channel_mgmt.c Haiyang Zhang2010-05-28  212  
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  213  
void vmbus_free_channels(void)
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  214  {
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  215 
struct vmbus_channel *channel;
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  216  
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12 @217 
list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  218 
vmbus_device_unregister(channel->device_obj);
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  219 
free_channel(channel);
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  220 
}
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  221  }
93e5bd06 drivers/hv/channel_mgmt.c K. Y. Srinivasan 2011-12-12  222  
3e189519 drivers/staging/hv/ChannelMgmt.c  Hank Janssen 2010-03-04  223  /*
e98cb276 drivers/staging/hv/channel_mgmt.c Haiyang Zhang2010-10-15  224   * 
vmbus_process_offer - Process the offer by creating a channel/device
c88c4e4c drivers/staging/hv/ChannelMgmt.c  Hank Janssen 2010-05-04  225   * 
associated with this offer

---
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] [asoc:topic/intel 34/37] sound/soc/intel/haswell/sst-haswell-pcm.c:1107 hsw_pcm_probe() error: buffer overflow 'hsw_dais' 4 <= 4

2015-04-07 Thread kbuild test robot
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 
topic/intel
head:   b97169da06992ef04081e66ed22bbdb23dbf6610
commit: ba57f68235cf6e9105bf649b01cf9eafc321ea7b [34/37] ASoC: Intel: create 
haswell folder and move haswell platform files in

sound/soc/intel/haswell/sst-haswell-pcm.c:1107 hsw_pcm_probe() error: buffer 
overflow 'hsw_dais' 4 <= 4
sound/soc/intel/haswell/sst-haswell-pcm.c:1109 hsw_pcm_probe() error: buffer 
overflow 'hsw_dais' 4 <= 4

git remote add asoc 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
git remote update asoc
git checkout ba57f68235cf6e9105bf649b01cf9eafc321ea7b
vim +/hsw_dais +1107 sound/soc/intel/haswell/sst-haswell-pcm.c

2e4f75919 sound/soc/intel/sst-haswell-pcm.c Liam Girdwood 2014-10-29  1101  
pm_runtime_idle(platform->dev);
2e4f75919 sound/soc/intel/sst-haswell-pcm.c Liam Girdwood 2014-10-29  1102  
a4b12990b sound/soc/intel/sst-haswell-pcm.c Mark Brown2014-03-12  1103  
return 0;
a4b12990b sound/soc/intel/sst-haswell-pcm.c Mark Brown2014-03-12  1104  
a4b12990b sound/soc/intel/sst-haswell-pcm.c Mark Brown2014-03-12  1105  err:
a4b12990b sound/soc/intel/sst-haswell-pcm.c Mark Brown2014-03-12  1106  
for (;i >= 0; i--) {
a4b12990b sound/soc/intel/sst-haswell-pcm.c Mark Brown2014-03-12 @1107  
if (hsw_dais[i].playback.channels_min)
0b708c87f sound/soc/intel/sst-haswell-pcm.c Liam Girdwood 2014-05-02  1108  
snd_dma_free_pages(&priv_data->dmab[i][0]);
a4b12990b sound/soc/intel/sst-haswell-pcm.c Mark Brown2014-03-12 @1109  
if (hsw_dais[i].capture.channels_min)
0b708c87f sound/soc/intel/sst-haswell-pcm.c Liam Girdwood 2014-05-02  1110  
snd_dma_free_pages(&priv_data->dmab[i][1]);
a4b12990b sound/soc/intel/sst-haswell-pcm.c Mark Brown2014-03-12    
}
0b708c87f sound/soc/intel/sst-haswell-pcm.c Liam Girdwood 2014-05-02  1112  
return 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