linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@intel.com>
To: Amitkumar Karwar <akarwar@marvell.com>,
	Jeffy Chen <jeffy.chen@rock-chips.com>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ganapathi Bhat <gbhat@marvell.com>, Cathy Luo <cluo@marvell.com>,
	Marcel Holtmann <marcel@holtmann.org>
Subject: Re: [v11,3/3] Bluetooth: hci_uart: Support firmware download for Marvell
Date: Thu, 30 Jun 2016 12:54:00 +0200	[thread overview]
Message-ID: <5774FA48.7080803@intel.com> (raw)
In-Reply-To: <ea454b25f2334ef9be0451a01cd15e15@SC-EXCH04.marvell.com>

Hi Amitkumar,


> Hi Marcel,

I suggest you to add Marcel as recipient of your patches.

>
>> From: Jeffy Chen [mailto:jeffy.chen@rock-chips.com]
>> Sent: Friday, June 24, 2016 11:32 AM
>> To: Amitkumar Karwar; linux-bluetooth@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org; Ganapathi Bhat
>> Subject: Re: [v11,3/3] Bluetooth: hci_uart: Support firmware download
>> for Marvell
>>
>> On 2016-5-6 23:31, Amitkumar Karwar wrote:
>>> From: Ganapathi Bhat <gbhat@marvell.com>
>>>
>>> This patch implement firmware download feature for Marvell Bluetooth
>>> devices. If firmware is already downloaded, it will skip downloading.


>>> +static struct sk_buff *mrvl_process_fw_data(struct hci_uart *hu,
>>> +					    struct sk_buff *skb,
>>> +					    u8 *buf, int count)
>>> +{
>>> +	struct mrvl_data *mrvl = hu->priv;
>>> +	struct fw_data *fw_data = mrvl->fwdata;
>>> +	int i = 0, len;
>>> +
>>> +	if (!skb) {
>>> +		while (buf[i] != fw_data->expected_ack && i < count)
>>> +			i++;
>>> +		if (i == count)
>>> +			return ERR_PTR(-EILSEQ);
>>> +
>>> +		skb = bt_skb_alloc(MRVL_FW_HDR_LEN, GFP_KERNEL);

Why you don't test skb here.

>>> +	}
>>> +
>>> +	if (!skb)
>>> +		return ERR_PTR(-ENOMEM);
>>> +
>>> +	len = count - i;
>>> +	memcpy(skb_put(skb, len), &buf[i], len);

You copy all the remaining data from buf into your skb, but what if buf 
contains more than one packet ? out of skb.
Don't assume that buf contains a full packet as well as only one packet.


Regards,
Loic

  reply	other threads:[~2016-06-30 10:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 15:31 [PATCH v11 1/3] Bluetooth: hci_uart: add prepare callbacks to hci_uart_proto structure Amitkumar Karwar
2016-05-06 15:31 ` [PATCH v11 2/3] Bluetooth: hci_uart: check if hdev is present before using it Amitkumar Karwar
2016-06-24  6:01   ` [v11, " Jeffy Chen
2016-05-06 15:31 ` [PATCH v11 3/3] Bluetooth: hci_uart: Support firmware download for Marvell Amitkumar Karwar
2016-05-10 13:59   ` Amitkumar Karwar
2016-05-23  6:06   ` Amitkumar Karwar
2016-06-14  6:35   ` Amitkumar Karwar
2016-06-21  3:47   ` [v11,3/3] " Caesar Wang
2016-06-24  6:02   ` Jeffy Chen
2016-06-27  6:28     ` Amitkumar Karwar
2016-06-30 10:54       ` Loic Poulain [this message]
2016-08-09 16:18         ` Amitkumar Karwar
2016-06-24  6:01 ` [v11, 1/3] Bluetooth: hci_uart: add prepare callbacks to hci_uart_proto structure Jeffy Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5774FA48.7080803@intel.com \
    --to=loic.poulain@intel.com \
    --cc=akarwar@marvell.com \
    --cc=cluo@marvell.com \
    --cc=gbhat@marvell.com \
    --cc=jeffy.chen@rock-chips.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).