]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Bluetooth: assign len after null check
authorWang Qing <wangqing@vivo.com>
Tue, 15 Feb 2022 02:01:56 +0000 (18:01 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 24 Feb 2022 20:05:21 +0000 (21:05 +0100)
len should be assigned after a null check

Signed-off-by: Wang Qing <wangqing@vivo.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt_util.c

index edee60bbc7b46dd189e7b83297d627432fcc280d..37eef2ce55aec45e7c097cc81a4a9e80f4925fd6 100644 (file)
@@ -77,11 +77,12 @@ int mgmt_send_event_skb(unsigned short channel, struct sk_buff *skb, int flag,
 {
        struct hci_dev *hdev;
        struct mgmt_hdr *hdr;
-       int len = skb->len;
+       int len;
 
        if (!skb)
                return -EINVAL;
 
+       len = skb->len;
        hdev = bt_cb(skb)->mgmt.hdev;
 
        /* Time stamp */