All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: johan.hedberg@intel.com
Cc: linux-bluetooth@vger.kernel.org
Subject: re: Bluetooth: Don't bother user space without IO capabilities
Date: Wed, 23 Jul 2014 13:14:13 +0300	[thread overview]
Message-ID: <20140723101413.GA24653@mwanda> (raw)

Hello Johan Hedberg,

The patch 02f3e2545791: "Bluetooth: Don't bother user space without
IO capabilities" from Jul 16, 2014, leads to the following static
checker warning:

	net/bluetooth/hci_event.c:3770 hci_user_confirm_request_evt()
	warn: we tested 'rem_mitm' before and it was 'false'

net/bluetooth/hci_event.c
  3760          /* If no side requires MITM protection; auto-accept */
  3761          if ((!loc_mitm || conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) &&
  3762              (!rem_mitm || conn->io_capability == HCI_IO_NO_INPUT_OUTPUT)) {
  3763  
  3764                  /* If we're not the initiators request authorization to
  3765                   * proceed from user space (mgmt_user_confirm with
  3766                   * confirm_hint set to 1). The exception is if neither
  3767                   * side had MITM or if the local IO capability is
  3768                   * NoInputNoOutput, in which case we do auto-accept
  3769                   */
  3770                  if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) &&
  3771                      conn->io_capability != HCI_IO_NO_INPUT_OUTPUT &&
  3772                      (loc_mitm || rem_mitm)) {

Checking for "conn->io_capability != HCI_IO_NO_INPUT_OUTPUT" implies
"rem_mitm" is false.  So this could be written as:

			if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) &&
			    conn->io_capability != HCI_IO_NO_INPUT_OUTPUT &&
			    loc_mitm) {

But it's not totally clear which is more readable.  Feel free to ignore
this email if you want.  :)

  3773                          BT_DBG("Confirming auto-accept as acceptor");
  3774                          confirm_hint = 1;
  3775                          goto confirm;
  3776                  }

regards,
dan carpenter

                 reply	other threads:[~2014-07-23 10:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140723101413.GA24653@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=johan.hedberg@intel.com \
    --cc=linux-bluetooth@vger.kernel.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.