Linux bluetooth development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: sathish.narasimman@intel.com
Cc: linux-bluetooth@vger.kernel.org
Subject: [bug report] Bluetooth: btusb: handle mSBC audio over USB Endpoints
Date: Tue, 7 Apr 2020 15:32:15 +0300	[thread overview]
Message-ID: <20200407123215.GA101015@mwanda> (raw)

Hello Sathish Narasimman,

This is a semi-automatic email about new static checker warnings.

The patch baac6276c0a9: "Bluetooth: btusb: handle mSBC audio over USB
Endpoints" from Apr 3, 2020, leads to the following Smatch complaint:

    drivers/bluetooth/btusb.c:1665 btusb_work()
    error: we previously assumed 'data->isoc' could be null (see line 1642)

drivers/bluetooth/btusb.c
  1641			if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
  1642				err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf);
                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This code assumes that "data->isoc" can be NULL.

  1643				if (err < 0) {
  1644					clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
  1645					usb_kill_anchored_urbs(&data->isoc_anchor);
  1646					return;
  1647				}
  1648	
  1649				set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
  1650			}
  1651	
  1652			if (data->air_mode == HCI_NOTIFY_ENABLE_SCO_CVSD) {
  1653				if (hdev->voice_setting & 0x0020) {
  1654					static const int alts[3] = { 2, 4, 5 };
  1655	
  1656					new_alts = alts[data->sco_num - 1];
  1657				} else {
  1658					new_alts = data->sco_num;
  1659				}
  1660			} else if (data->air_mode == HCI_NOTIFY_ENABLE_SCO_TRANSP) {
  1661	
  1662				data->usb_alt6_packet_flow = true;
  1663	
  1664				/* Check if Alt 6 is supported for Transparent audio */
  1665				if (btusb_find_altsetting(data, 6))
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
The new btusb_find_altsetting() dereferences it without checking.

  1666					new_alts = 6;
  1667				else

regards,
dan carpenter

             reply	other threads:[~2020-04-07 12:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07 12:32 Dan Carpenter [this message]
2020-04-07 16:29 ` [bug report] Bluetooth: btusb: handle mSBC audio over USB Endpoints Marcel Holtmann

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=20200407123215.GA101015@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=sathish.narasimman@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox