From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932371AbcHIQSQ (ORCPT ); Tue, 9 Aug 2016 12:18:16 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:45111 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752680AbcHIQSM (ORCPT ); Tue, 9 Aug 2016 12:18:12 -0400 From: Amitkumar Karwar To: Loic Poulain , Jeffy Chen , "linux-bluetooth@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , "Ganapathi Bhat" , Marcel Holtmann Subject: RE: [v11,3/3] Bluetooth: hci_uart: Support firmware download for Marvell Thread-Topic: [v11,3/3] Bluetooth: hci_uart: Support firmware download for Marvell Thread-Index: AQHRzd2OqwCoMAiL9Uyv+3sUJB87hZ/83aqQgAV3XQCAPsBD0A== Date: Tue, 9 Aug 2016 16:18:02 +0000 Message-ID: <2680ec4f15c0459298c7ca91bdf73f31@SC-EXCH04.marvell.com> References: <1462548714-7971-3-git-send-email-akarwar@marvell.com> <576CCCDE.1050004@rock-chips.com> <5774FA48.7080803@intel.com> In-Reply-To: <5774FA48.7080803@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.93.176.43] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-09_06:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608090165 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u79GIPhb029398 Hi Loic, > -----Original Message----- > From: Loic Poulain [mailto:loic.poulain@intel.com] > Sent: Thursday, June 30, 2016 4:24 PM > To: Amitkumar Karwar; Jeffy Chen; linux-bluetooth@vger.kernel.org > Cc: linux-kernel@vger.kernel.org; Ganapathi Bhat; Cathy Luo; Marcel > Holtmann > Subject: Re: [v11,3/3] Bluetooth: hci_uart: Support firmware download > for Marvell > > 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 > >>> > >>> 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. > > Thanks for your comments. We have added necessarily checks to address these comments. I will submit updated version shortly. Regards, Amitkumar Karwar