All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 3872/6512] net/bluetooth/smp.c:1633 smp_user_confirm_reply() warn: variable dereferenced before check 'conn' (see line 1631)
Date: Tue, 23 Mar 2021 15:43:24 +0300	[thread overview]
Message-ID: <20210323124324.GL1667@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 2565 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git  master
head:   d949689e7383cd5271470f2b99dbe2fd3199bffd
commit: 2e1614f7d61e407f1a8e7935a2903a6fa3cb0b11 [3872/6512] Bluetooth: SMP: Convert BT_ERR/BT_DBG to bt_dev_err/bt_dev_dbg
config: powerpc-randconfig-m031-20210323 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/bluetooth/smp.c:1633 smp_user_confirm_reply() warn: variable dereferenced before check 'conn' (see line 1631)

vim +/conn +1633 net/bluetooth/smp.c

2b64d153a0cc9d Brian Gix              2011-12-21  1623  int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey)
2b64d153a0cc9d Brian Gix              2011-12-21  1624  {
b10e8017bd9d02 Johan Hedberg          2014-06-27  1625  	struct l2cap_conn *conn = hcon->l2cap_data;
5d88cc73dded31 Johan Hedberg          2014-08-08  1626  	struct l2cap_chan *chan;
2b64d153a0cc9d Brian Gix              2011-12-21  1627  	struct smp_chan *smp;
2b64d153a0cc9d Brian Gix              2011-12-21  1628  	u32 value;
fc75cc8684d21d Johan Hedberg          2014-09-05  1629  	int err;
2b64d153a0cc9d Brian Gix              2011-12-21  1630  
2e1614f7d61e40 Luiz Augusto von Dentz 2021-03-15 @1631  	bt_dev_dbg(conn->hcon->hdev, "");
                                                                           ^^^^^^^^^^
Unchecked dereference

2b64d153a0cc9d Brian Gix              2011-12-21  1632  
fc75cc8684d21d Johan Hedberg          2014-09-05 @1633  	if (!conn)
                                                                    ^^^^^
Checked too late

2b64d153a0cc9d Brian Gix              2011-12-21  1634  		return -ENOTCONN;
2b64d153a0cc9d Brian Gix              2011-12-21  1635  
5d88cc73dded31 Johan Hedberg          2014-08-08  1636  	chan = conn->smp;
5d88cc73dded31 Johan Hedberg          2014-08-08  1637  	if (!chan)
5d88cc73dded31 Johan Hedberg          2014-08-08  1638  		return -ENOTCONN;
5d88cc73dded31 Johan Hedberg          2014-08-08  1639  
fc75cc8684d21d Johan Hedberg          2014-09-05  1640  	l2cap_chan_lock(chan);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25715 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [kbuild] [linux-next:master 3872/6512] net/bluetooth/smp.c:1633 smp_user_confirm_reply() warn: variable dereferenced before check 'conn' (see line 1631)
Date: Tue, 23 Mar 2021 15:43:24 +0300	[thread overview]
Message-ID: <20210323124324.GL1667@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 2565 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git  master
head:   d949689e7383cd5271470f2b99dbe2fd3199bffd
commit: 2e1614f7d61e407f1a8e7935a2903a6fa3cb0b11 [3872/6512] Bluetooth: SMP: Convert BT_ERR/BT_DBG to bt_dev_err/bt_dev_dbg
config: powerpc-randconfig-m031-20210323 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/bluetooth/smp.c:1633 smp_user_confirm_reply() warn: variable dereferenced before check 'conn' (see line 1631)

vim +/conn +1633 net/bluetooth/smp.c

2b64d153a0cc9d Brian Gix              2011-12-21  1623  int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey)
2b64d153a0cc9d Brian Gix              2011-12-21  1624  {
b10e8017bd9d02 Johan Hedberg          2014-06-27  1625  	struct l2cap_conn *conn = hcon->l2cap_data;
5d88cc73dded31 Johan Hedberg          2014-08-08  1626  	struct l2cap_chan *chan;
2b64d153a0cc9d Brian Gix              2011-12-21  1627  	struct smp_chan *smp;
2b64d153a0cc9d Brian Gix              2011-12-21  1628  	u32 value;
fc75cc8684d21d Johan Hedberg          2014-09-05  1629  	int err;
2b64d153a0cc9d Brian Gix              2011-12-21  1630  
2e1614f7d61e40 Luiz Augusto von Dentz 2021-03-15 @1631  	bt_dev_dbg(conn->hcon->hdev, "");
                                                                           ^^^^^^^^^^
Unchecked dereference

2b64d153a0cc9d Brian Gix              2011-12-21  1632  
fc75cc8684d21d Johan Hedberg          2014-09-05 @1633  	if (!conn)
                                                                    ^^^^^
Checked too late

2b64d153a0cc9d Brian Gix              2011-12-21  1634  		return -ENOTCONN;
2b64d153a0cc9d Brian Gix              2011-12-21  1635  
5d88cc73dded31 Johan Hedberg          2014-08-08  1636  	chan = conn->smp;
5d88cc73dded31 Johan Hedberg          2014-08-08  1637  	if (!chan)
5d88cc73dded31 Johan Hedberg          2014-08-08  1638  		return -ENOTCONN;
5d88cc73dded31 Johan Hedberg          2014-08-08  1639  
fc75cc8684d21d Johan Hedberg          2014-09-05  1640  	l2cap_chan_lock(chan);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25715 bytes --]

             reply	other threads:[~2021-03-23 12:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 12:43 Dan Carpenter [this message]
2021-03-23 12:43 ` [kbuild] [linux-next:master 3872/6512] net/bluetooth/smp.c:1633 smp_user_confirm_reply() warn: variable dereferenced before check 'conn' (see line 1631) Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-03-23  9:52 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210323124324.GL1667@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.