OSDN Git Service

Bluetooth: Use only 8 bits for the HCI CMSG state flags
authorAlain Michaud <alainm@chromium.org>
Thu, 11 Jun 2020 14:26:10 +0000 (14:26 +0000)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 12 Jun 2020 13:10:46 +0000 (15:10 +0200)
This change implements suggestions from the code review of the SCO CMSG
state flag patch.

Signed-off-by: Alain Michaud <alainm@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_sock.h
net/bluetooth/hci_sock.c

index 9352bb1..9949870 100644 (file)
@@ -31,8 +31,8 @@
 #define HCI_TIME_STAMP 3
 
 /* CMSG flags */
-#define HCI_CMSG_DIR   0x0001
-#define HCI_CMSG_TSTAMP        0x0002
+#define HCI_CMSG_DIR   0x01
+#define HCI_CMSG_TSTAMP        0x02
 
 struct sockaddr_hci {
        sa_family_t    hci_family;
index caf38a8..d562796 100644 (file)
@@ -52,7 +52,7 @@ struct hci_pinfo {
        struct bt_sock    bt;
        struct hci_dev    *hdev;
        struct hci_filter filter;
-       __u32             cmsg_mask;
+       __u             cmsg_mask;
        unsigned short    channel;
        unsigned long     flags;
        __u32             cookie;
@@ -1399,7 +1399,7 @@ done:
 static void hci_sock_cmsg(struct sock *sk, struct msghdr *msg,
                          struct sk_buff *skb)
 {
-       __u32 mask = hci_pi(sk)->cmsg_mask;
+       __u8 mask = hci_pi(sk)->cmsg_mask;
 
        if (mask & HCI_CMSG_DIR) {
                int incoming = bt_cb(skb)->incoming;