Bluetooth: change min_t() cast in hci_reassembly()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 28 Feb 2012 06:57:59 +0000 (09:57 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 29 Feb 2012 14:19:37 +0000 (16:19 +0200)
"count" is type int so the cast to __u16 truncates the high bits away
and triggers a Smatch static checker warning.  It looks like a high
value of count could cause a forever loop, but I didn't follow it
through to see if count is capped somewhere.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_core.c

index e6cbb8a1f47dd61f8d220726aefbc18e9c2a2d15..db484a8e73649cedd60a952ab42af54a83a7f10d 100644 (file)
@@ -1966,7 +1966,7 @@ static int hci_reassembly(struct hci_dev *hdev, int type, void *data,
 
        while (count) {
                scb = (void *) skb->cb;
-               len = min_t(__u16, scb->expect, count);
+               len = min_t(uint, scb->expect, count);
 
                memcpy(skb_put(skb, len), data, len);