aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm/sock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/rfcomm/sock.c')
-rw-r--r--net/bluetooth/rfcomm/sock.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index ca87d6ac6a20..8d0ee0b8a6b6 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -1068,13 +1068,22 @@ static ssize_t rfcomm_sock_sysfs_show(struct class *dev,
1068 struct sock *sk; 1068 struct sock *sk;
1069 struct hlist_node *node; 1069 struct hlist_node *node;
1070 char *str = buf; 1070 char *str = buf;
1071 int size = PAGE_SIZE;
1071 1072
1072 read_lock_bh(&rfcomm_sk_list.lock); 1073 read_lock_bh(&rfcomm_sk_list.lock);
1073 1074
1074 sk_for_each(sk, node, &rfcomm_sk_list.head) { 1075 sk_for_each(sk, node, &rfcomm_sk_list.head) {
1075 str += sprintf(str, "%s %s %d %d\n", 1076 int len;
1077
1078 len = snprintf(str, size, "%s %s %d %d\n",
1076 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 1079 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst),
1077 sk->sk_state, rfcomm_pi(sk)->channel); 1080 sk->sk_state, rfcomm_pi(sk)->channel);
1081
1082 size -= len;
1083 if (size <= 0)
1084 break;
1085
1086 str += len;
1078 } 1087 }
1079 1088
1080 read_unlock_bh(&rfcomm_sk_list.lock); 1089 read_unlock_bh(&rfcomm_sk_list.lock);