Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1434441

Re: [v11,3/3] Bluetooth: hci_uart: Support firmware download for Marvell

Path csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Loic Poulain <loic.poulain@intel.com>
Newsgroups linux.kernel
Subject Re: [v11,3/3] Bluetooth: hci_uart: Support firmware download for Marvell
Date Thu, 30 Jun 2016 13:00:02 +0200
Message-ID <rPHRo-72-7@gated-at.bofh.it> (permalink)
References <rvQ1c-7PI-13@gated-at.bofh.it> <rNsts-4rr-19@gated-at.bofh.it> <rOyds-502-15@gated-at.bofh.it>
X-Original-To Amitkumar Karwar <akarwar@marvell.com>, Jeffy Chen <jeffy.chen@rock-chips.com>, "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
X-Extloop1 1
X-Ironport-Av E=Sophos;i="5.26,551,1459839600"; d="scan'208";a="131172292"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
X-Original-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>
X-Original-Date Thu, 30 Jun 2016 12:54:00 +0200
X-Original-Message-ID <5774FA48.7080803@intel.com>
X-Original-References <1462548714-7971-3-git-send-email-akarwar@marvell.com> <576CCCDE.1050004@rock-chips.com> <ea454b25f2334ef9be0451a01cd15e15@SC-EXCH04.marvell.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1434441

Show key headers only | View raw


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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

RE: [v11,3/3] Bluetooth: hci_uart: Support firmware download for  Marvell Amitkumar Karwar <akarwar@marvell.com> - 2016-06-27 08:30 +0200
  Re: [v11,3/3] Bluetooth: hci_uart: Support firmware download for  Marvell Loic Poulain <loic.poulain@intel.com> - 2016-06-30 13:00 +0200

csiph-web