Commit 6ed93dc6 authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Gustavo Padovan

Bluetooth: Use %pMR in debug instead of batostr

Instead of old unsafe batostr function use %pMR print specifier
for printing Bluetooth addresses in debug and error statements.
Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent 36a75f1b
...@@ -182,8 +182,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) ...@@ -182,8 +182,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
a2 = data; a2 = data;
data += ETH_ALEN; data += ETH_ALEN;
BT_DBG("mc filter %s -> %s", BT_DBG("mc filter %pMR -> %pMR", a1, a2);
batostr((void *) a1), batostr((void *) a2));
/* Iterate from a1 to a2 */ /* Iterate from a1 to a2 */
set_bit(bnep_mc_hash(a1), (ulong *) &s->mc_filter); set_bit(bnep_mc_hash(a1), (ulong *) &s->mc_filter);
......
...@@ -320,7 +320,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) ...@@ -320,7 +320,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
{ {
struct hci_conn *conn; struct hci_conn *conn;
BT_DBG("%s dst %s", hdev->name, batostr(dst)); BT_DBG("%s dst %pMR", hdev->name, dst);
conn = kzalloc(sizeof(struct hci_conn), GFP_KERNEL); conn = kzalloc(sizeof(struct hci_conn), GFP_KERNEL);
if (!conn) if (!conn)
...@@ -437,7 +437,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src) ...@@ -437,7 +437,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
int use_src = bacmp(src, BDADDR_ANY); int use_src = bacmp(src, BDADDR_ANY);
struct hci_dev *hdev = NULL, *d; struct hci_dev *hdev = NULL, *d;
BT_DBG("%s -> %s", batostr(src), batostr(dst)); BT_DBG("%pMR -> %pMR", src, dst);
read_lock(&hci_dev_list_lock); read_lock(&hci_dev_list_lock);
...@@ -567,7 +567,7 @@ static struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, ...@@ -567,7 +567,7 @@ static struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type,
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
__u8 dst_type, __u8 sec_level, __u8 auth_type) __u8 dst_type, __u8 sec_level, __u8 auth_type)
{ {
BT_DBG("%s dst %s type 0x%x", hdev->name, batostr(dst), type); BT_DBG("%s dst %pMR type 0x%x", hdev->name, dst, type);
switch (type) { switch (type) {
case LE_LINK: case LE_LINK:
......
...@@ -405,7 +405,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, ...@@ -405,7 +405,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
struct discovery_state *cache = &hdev->discovery; struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *e; struct inquiry_entry *e;
BT_DBG("cache %p, %s", cache, batostr(bdaddr)); BT_DBG("cache %p, %pMR", cache, bdaddr);
list_for_each_entry(e, &cache->all, all) { list_for_each_entry(e, &cache->all, all) {
if (!bacmp(&e->data.bdaddr, bdaddr)) if (!bacmp(&e->data.bdaddr, bdaddr))
...@@ -421,7 +421,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev, ...@@ -421,7 +421,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
struct discovery_state *cache = &hdev->discovery; struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *e; struct inquiry_entry *e;
BT_DBG("cache %p, %s", cache, batostr(bdaddr)); BT_DBG("cache %p, %pMR", cache, bdaddr);
list_for_each_entry(e, &cache->unknown, list) { list_for_each_entry(e, &cache->unknown, list) {
if (!bacmp(&e->data.bdaddr, bdaddr)) if (!bacmp(&e->data.bdaddr, bdaddr))
...@@ -438,7 +438,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, ...@@ -438,7 +438,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
struct discovery_state *cache = &hdev->discovery; struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *e; struct inquiry_entry *e;
BT_DBG("cache %p bdaddr %s state %d", cache, batostr(bdaddr), state); BT_DBG("cache %p bdaddr %pMR state %d", cache, bdaddr, state);
list_for_each_entry(e, &cache->resolve, list) { list_for_each_entry(e, &cache->resolve, list) {
if (!bacmp(bdaddr, BDADDR_ANY) && e->name_state == state) if (!bacmp(bdaddr, BDADDR_ANY) && e->name_state == state)
...@@ -475,7 +475,7 @@ bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, ...@@ -475,7 +475,7 @@ bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
struct discovery_state *cache = &hdev->discovery; struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *ie; struct inquiry_entry *ie;
BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr)); BT_DBG("cache %p, %pMR", cache, &data->bdaddr);
if (ssp) if (ssp)
*ssp = data->ssp_mode; *ssp = data->ssp_mode;
...@@ -1257,7 +1257,7 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, ...@@ -1257,7 +1257,7 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
list_add(&key->list, &hdev->link_keys); list_add(&key->list, &hdev->link_keys);
} }
BT_DBG("%s key for %s type %u", hdev->name, batostr(bdaddr), type); BT_DBG("%s key for %pMR type %u", hdev->name, bdaddr, type);
/* Some buggy controller combinations generate a changed /* Some buggy controller combinations generate a changed
* combination key for legacy pairing even when there's no * combination key for legacy pairing even when there's no
...@@ -1336,7 +1336,7 @@ int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) ...@@ -1336,7 +1336,7 @@ int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr)
if (!key) if (!key)
return -ENOENT; return -ENOENT;
BT_DBG("%s removing %s", hdev->name, batostr(bdaddr)); BT_DBG("%s removing %pMR", hdev->name, bdaddr);
list_del(&key->list); list_del(&key->list);
kfree(key); kfree(key);
...@@ -1352,7 +1352,7 @@ int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr) ...@@ -1352,7 +1352,7 @@ int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr)
if (bacmp(bdaddr, &k->bdaddr)) if (bacmp(bdaddr, &k->bdaddr))
continue; continue;
BT_DBG("%s removing %s", hdev->name, batostr(bdaddr)); BT_DBG("%s removing %pMR", hdev->name, bdaddr);
list_del(&k->list); list_del(&k->list);
kfree(k); kfree(k);
...@@ -1399,7 +1399,7 @@ int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr) ...@@ -1399,7 +1399,7 @@ int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr)
if (!data) if (!data)
return -ENOENT; return -ENOENT;
BT_DBG("%s removing %s", hdev->name, batostr(bdaddr)); BT_DBG("%s removing %pMR", hdev->name, bdaddr);
list_del(&data->list); list_del(&data->list);
kfree(data); kfree(data);
...@@ -1438,7 +1438,7 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, ...@@ -1438,7 +1438,7 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
memcpy(data->hash, hash, sizeof(data->hash)); memcpy(data->hash, hash, sizeof(data->hash));
memcpy(data->randomizer, randomizer, sizeof(data->randomizer)); memcpy(data->randomizer, randomizer, sizeof(data->randomizer));
BT_DBG("%s for %s", hdev->name, batostr(bdaddr)); BT_DBG("%s for %pMR", hdev->name, bdaddr);
return 0; return 0;
} }
...@@ -2309,8 +2309,8 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type) ...@@ -2309,8 +2309,8 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type)
/* Kill stalled connections */ /* Kill stalled connections */
list_for_each_entry_rcu(c, &h->list, list) { list_for_each_entry_rcu(c, &h->list, list) {
if (c->type == type && c->sent) { if (c->type == type && c->sent) {
BT_ERR("%s killing stalled connection %s", BT_ERR("%s killing stalled connection %pMR",
hdev->name, batostr(&c->dst)); hdev->name, &c->dst);
hci_acl_disconn(c, HCI_ERROR_REMOTE_USER_TERM); hci_acl_disconn(c, HCI_ERROR_REMOTE_USER_TERM);
} }
} }
......
...@@ -1266,7 +1266,7 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) ...@@ -1266,7 +1266,7 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr);
BT_DBG("%s bdaddr %s hcon %p", hdev->name, batostr(&cp->bdaddr), conn); BT_DBG("%s bdaddr %pMR hcon %p", hdev->name, &cp->bdaddr, conn);
if (status) { if (status) {
if (conn && conn->state == BT_CONNECT) { if (conn && conn->state == BT_CONNECT) {
...@@ -1695,8 +1695,7 @@ static void hci_cs_le_create_conn(struct hci_dev *hdev, __u8 status) ...@@ -1695,8 +1695,7 @@ static void hci_cs_le_create_conn(struct hci_dev *hdev, __u8 status)
return; return;
} }
BT_DBG("%s bdaddr %s conn %p", hdev->name, batostr(&conn->dst), BT_DBG("%s bdaddr %pMR conn %p", hdev->name, &conn->dst, conn);
conn);
conn->state = BT_CLOSED; conn->state = BT_CLOSED;
mgmt_connect_failed(hdev, &conn->dst, conn->type, mgmt_connect_failed(hdev, &conn->dst, conn->type,
...@@ -1910,7 +1909,7 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -1910,7 +1909,7 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
struct hci_ev_conn_request *ev = (void *) skb->data; struct hci_ev_conn_request *ev = (void *) skb->data;
int mask = hdev->link_mode; int mask = hdev->link_mode;
BT_DBG("%s bdaddr %s type 0x%x", hdev->name, batostr(&ev->bdaddr), BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr,
ev->link_type); ev->link_type);
mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type); mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type);
...@@ -2809,13 +2808,13 @@ static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -2809,13 +2808,13 @@ static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
key = hci_find_link_key(hdev, &ev->bdaddr); key = hci_find_link_key(hdev, &ev->bdaddr);
if (!key) { if (!key) {
BT_DBG("%s link key not found for %s", hdev->name, BT_DBG("%s link key not found for %pMR", hdev->name,
batostr(&ev->bdaddr)); &ev->bdaddr);
goto not_found; goto not_found;
} }
BT_DBG("%s found key type %u for %s", hdev->name, key->type, BT_DBG("%s found key type %u for %pMR", hdev->name, key->type,
batostr(&ev->bdaddr)); &ev->bdaddr);
if (!test_bit(HCI_DEBUG_KEYS, &hdev->dev_flags) && if (!test_bit(HCI_DEBUG_KEYS, &hdev->dev_flags) &&
key->type == HCI_LK_DEBUG_COMBINATION) { key->type == HCI_LK_DEBUG_COMBINATION) {
......
...@@ -1471,7 +1471,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, ...@@ -1471,7 +1471,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
__u8 auth_type; __u8 auth_type;
int err; int err;
BT_DBG("%s -> %s (type %u) psm 0x%2.2x", batostr(src), batostr(dst), BT_DBG("%pMR -> %pMR (type %u) psm 0x%2.2x", src, dst,
dst_type, __le16_to_cpu(psm)); dst_type, __le16_to_cpu(psm));
hdev = hci_get_route(dst, src); hdev = hci_get_route(dst, src);
...@@ -5346,7 +5346,7 @@ int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr) ...@@ -5346,7 +5346,7 @@ int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr)
int exact = 0, lm1 = 0, lm2 = 0; int exact = 0, lm1 = 0, lm2 = 0;
struct l2cap_chan *c; struct l2cap_chan *c;
BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); BT_DBG("hdev %s, bdaddr %pMR", hdev->name, bdaddr);
/* Find listening sockets and check their link_mode */ /* Find listening sockets and check their link_mode */
read_lock(&chan_list_lock); read_lock(&chan_list_lock);
...@@ -5376,7 +5376,7 @@ void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) ...@@ -5376,7 +5376,7 @@ void l2cap_connect_cfm(struct hci_conn *hcon, u8 status)
{ {
struct l2cap_conn *conn; struct l2cap_conn *conn;
BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status);
if (!status) { if (!status) {
conn = l2cap_conn_add(hcon, status); conn = l2cap_conn_add(hcon, status);
......
...@@ -377,8 +377,8 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, ...@@ -377,8 +377,8 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
int err = 0; int err = 0;
u8 dlci; u8 dlci;
BT_DBG("dlc %p state %ld %s %s channel %d", BT_DBG("dlc %p state %ld %pMR -> %pMR channel %d",
d, d->state, batostr(src), batostr(dst), channel); d, d->state, src, dst, channel);
if (channel < 1 || channel > 30) if (channel < 1 || channel > 30)
return -EINVAL; return -EINVAL;
...@@ -676,7 +676,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, ...@@ -676,7 +676,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
struct socket *sock; struct socket *sock;
struct sock *sk; struct sock *sk;
BT_DBG("%s %s", batostr(src), batostr(dst)); BT_DBG("%pMR -> %pMR", src, dst);
*err = rfcomm_l2sock_create(&sock); *err = rfcomm_l2sock_create(&sock);
if (*err < 0) if (*err < 0)
......
...@@ -334,7 +334,7 @@ static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr ...@@ -334,7 +334,7 @@ static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = 0; int err = 0;
BT_DBG("sk %p %s", sk, batostr(&sa->rc_bdaddr)); BT_DBG("sk %p %pMR", sk, &sa->rc_bdaddr);
if (!addr || addr->sa_family != AF_BLUETOOTH) if (!addr || addr->sa_family != AF_BLUETOOTH)
return -EINVAL; return -EINVAL;
......
...@@ -663,8 +663,8 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) ...@@ -663,8 +663,8 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst), BT_DBG("dev %p dst %pMR channel %d opened %d", dev, &dev->dst,
dev->channel, dev->port.count); dev->channel, dev->port.count);
spin_lock_irqsave(&dev->port.lock, flags); spin_lock_irqsave(&dev->port.lock, flags);
if (++dev->port.count > 1) { if (++dev->port.count > 1) {
......
...@@ -172,7 +172,7 @@ static int sco_connect(struct sock *sk) ...@@ -172,7 +172,7 @@ static int sco_connect(struct sock *sk)
struct hci_dev *hdev; struct hci_dev *hdev;
int err, type; int err, type;
BT_DBG("%s -> %s", batostr(src), batostr(dst)); BT_DBG("%pMR -> %pMR", src, dst);
hdev = hci_get_route(dst, src); hdev = hci_get_route(dst, src);
if (!hdev) if (!hdev)
...@@ -460,7 +460,7 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le ...@@ -460,7 +460,7 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = 0; int err = 0;
BT_DBG("sk %p %s", sk, batostr(&sa->sco_bdaddr)); BT_DBG("sk %p %pMR", sk, &sa->sco_bdaddr);
if (!addr || addr->sa_family != AF_BLUETOOTH) if (!addr || addr->sa_family != AF_BLUETOOTH)
return -EINVAL; return -EINVAL;
...@@ -893,7 +893,7 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr) ...@@ -893,7 +893,7 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr)
struct hlist_node *node; struct hlist_node *node;
int lm = 0; int lm = 0;
BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); BT_DBG("hdev %s, bdaddr %pMR", hdev->name, bdaddr);
/* Find listening sockets */ /* Find listening sockets */
read_lock(&sco_sk_list.lock); read_lock(&sco_sk_list.lock);
...@@ -914,7 +914,7 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr) ...@@ -914,7 +914,7 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr)
void sco_connect_cfm(struct hci_conn *hcon, __u8 status) void sco_connect_cfm(struct hci_conn *hcon, __u8 status)
{ {
BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status);
if (!status) { if (!status) {
struct sco_conn *conn; struct sco_conn *conn;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment