linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: Bluetooth: Don't bother user space without IO capabilities
@ 2014-07-23 10:14 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-07-23 10:14 UTC (permalink / raw)
  To: johan.hedberg; +Cc: linux-bluetooth

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-07-23 10:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-23 10:14 Bluetooth: Don't bother user space without IO capabilities Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).