Hi Anderson On Fri, Jan 27, 2012 at 5:51 PM, Anderson Lizardo <anderson.lizardo@xxxxxxxxxxxxx> wrote: > Hi David, > > On Fri, Jan 27, 2012 at 11:47 AM, David Herrmann > <dh.herrmann@xxxxxxxxxxxxxx> wrote: >> diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c >> index 66b58fd..8d0e090 100644 >> --- a/drivers/bluetooth/btmrvl_main.c >> +++ b/drivers/bluetooth/btmrvl_main.c >> @@ -394,12 +394,12 @@ static int btmrvl_send_frame(struct sk_buff *skb) >> >> BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len); >> >> - if (!hdev || !hdev->driver_data) { >> + priv = hci_get_drvdata(hdev); >> + if (!hdev || !priv) { > > The change above will cause problems if hdev is NULL. > hci_get_drvdata() dereferences hdev without checking for NULL. Thanks for reviewing. I will resend it without the check for !priv. It doesn't make sense to check this. It can never be NULL, anyway. >> BT_ERR("Frame for unknown HCI device"); >> return -ENODEV; >> } >> >> - priv = (struct btmrvl_private *) hdev->driver_data; >> if (!test_bit(HCI_RUNNING, &hdev->flags)) { >> BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags); >> print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET, > [...] >> @@ -614,6 +613,16 @@ static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) >> >> #define to_hci_dev(d) container_of(d, struct hci_dev, dev) >> >> +static inline void *hci_get_drvdata(struct hci_dev *hdev) >> +{ >> + return dev_get_drvdata(&hdev->dev); >> +} >> + >> +static inline void hci_set_drvdata(struct hci_dev *hdev, void *data) >> +{ >> + dev_set_drvdata(&hdev->dev, data); >> +} >> + >> struct hci_dev *hci_dev_get(int index); >> struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); > > Regards, Regards David -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html