From: Ravi Kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org, Johan Hedberg <johan.hedberg@gmail.com>
Subject: Re: [PATCH_v3 03/04] android/hid: Implement hid get report in daemon
Date: Tue, 05 Nov 2013 15:55:14 +0200 [thread overview]
Message-ID: <5278F8C2.8070608@linux.intel.com> (raw)
In-Reply-To: <20131105131606.GC15228@x220.p-661hnu-f1>
On 11/05/2013 03:16 PM, Johan Hedberg wrote:
> Hi Ravi,
>
> On Tue, Nov 05, 2013, Ravi kumar Veeramally wrote:
>> + if (!((buf[0] == (HID_MSG_DATA | HID_DATA_TYPE_INPUT)) ||
>> + (buf[0] == (HID_MSG_DATA | HID_DATA_TYPE_OUTPUT)) ||
>> + (buf[0] == (HID_MSG_DATA | HID_DATA_TYPE_FEATURE)))) {
>> + ev = g_malloc(len);
>> + memset(ev, 0, ev_len);
> Is it intentional that you allocate a different length than what you
> memset to 0 here? If they should be the same just use g_malloc0, and if
> not a code comment might be in order (to explain what the actual
> intention is).
Ok, type, it should be ev_len.
>> + ev = g_malloc(ev_len);
>> + memset(ev, 0, ev_len);
> Here g_malloc0 makes more sense.
>
>> + ev->status = HAL_HID_STATUS_OK;
>> + bdaddr2android(&dev->dst, ev->bdaddr);
>> +
>> + /* Report porotocol mode reply contains id after hdr, in boot
>> + * protocol mode id doesn't exist */
>> + if (dev->boot_dev) {
>> + ev->len = len - 1;
>> + memcpy(ev->data, buf + 1, ev->len);
>> + } else {
>> + ev->len = len - 2;
>> + memcpy(ev->data, buf + 2, ev->len);
>> + }
>> +
>> +send:
>> + ipc_send(notification_io, HAL_SERVICE_ID_HIDHOST, HAL_EV_HID_GET_REPORT,
>> + ev_len, ev, -1);
> This doesn't look right for your first allocation (you claim that the
> length of ev is ev_len, but in fact you allocated len amount of bytes.
Ok. I will fix it.
Thanks,
Ravi.
next prev parent reply other threads:[~2013-11-05 13:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 12:22 [PATCH_v3 01/04] android/hid: Implement hid get protocol in daemon Ravi kumar Veeramally
2013-11-05 12:22 ` [PATCH_v3 02/04] android/hid: Implement hid set " Ravi kumar Veeramally
2013-11-05 13:12 ` Johan Hedberg
2013-11-05 13:52 ` Ravi Kumar Veeramally
2013-11-05 12:22 ` [PATCH_v3 03/04] android/hid: Implement hid get report " Ravi kumar Veeramally
2013-11-05 13:16 ` Johan Hedberg
2013-11-05 13:55 ` Ravi Kumar Veeramally [this message]
2013-11-05 12:22 ` [PATCH_v3 04/04] android/hid: Implement hid set " Ravi kumar Veeramally
2013-11-05 13:10 ` [PATCH_v3 01/04] android/hid: Implement hid get protocol " Johan Hedberg
2013-11-05 13:27 ` Ravi Kumar Veeramally
2013-11-05 15:58 ` Johan Hedberg
2013-11-05 17:28 ` ravikumar.veeramally
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=5278F8C2.8070608@linux.intel.com \
--to=ravikumar.veeramally@linux.intel.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.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).