Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ v2 2/9] Add support for storing SMP keys
Date: Thu, 07 Jul 2011 10:28:02 +0200	[thread overview]
Message-ID: <1310027300.21109.55.camel@aeonflux> (raw)
In-Reply-To: <1309983041-23744-3-git-send-email-vinicius.gomes@openbossa.org>

Hi Vinicius,

>  plugins/mgmtops.c |    4 ++--
>  src/event.c       |   44 +++++++++++++++++++++++++++++++++++++++++---
>  src/storage.c     |   25 ++++++++++++++++++++++++-
>  src/storage.h     |    1 +
>  4 files changed, 68 insertions(+), 6 deletions(-)
> 
> diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
> index 6b5422e..f11ff50 100644
> --- a/plugins/mgmtops.c
> +++ b/plugins/mgmtops.c
> @@ -383,8 +383,8 @@ static void mgmt_new_key(int sk, uint16_t index, void *buf, size_t len)
>  	struct mgmt_ev_new_key *ev = buf;
>  	struct controller_info *info;
>  
> -	if (len != sizeof(*ev)) {
> -		error("new_key event size mismatch (%zu != %zu)",
> +	if (len < sizeof(*ev)) {
> +		error("new_key event size mismatch (%zu < %zu)",
>  							len, sizeof(*ev));
>  		return;
>  	}
> diff --git a/src/event.c b/src/event.c
> index 3f0f454..9cdb5e1 100644
> --- a/src/event.c
> +++ b/src/event.c
> @@ -395,6 +395,43 @@ proceed:
>  	adapter_set_state(adapter, STATE_IDLE);
>  }
>  
> +static gchar *buf2str(uint8_t *data, int datalen)
> +{
> +	gchar *buf;
> +	int i;

please that not use more gchar anymore. Just use plain char.

> +	buf = g_new0(gchar, (datalen * 2) + 1);

Is it okay to not use g_try_new0.

> +
> +	for (i = 0; i < datalen; i++)
> +		sprintf(buf + (i * 2), "%2.2x", data[i]);
> +
> +	return buf;
> +}

Regards

Marcel



  reply	other threads:[~2011-07-07  8:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-06 20:10 [PATCH BlueZ v2 0/9] Permanent storage of SMP keys Vinicius Costa Gomes
2011-07-06 20:10 ` [PATCH BlueZ v2 1/9] Add stubs for storing " Vinicius Costa Gomes
2011-07-06 20:10 ` [PATCH BlueZ v2 2/9] Add support " Vinicius Costa Gomes
2011-07-07  8:28   ` Marcel Holtmann [this message]
2011-07-06 20:10 ` [PATCH BlueZ v2 3/9] Add support for creating the device from the " Vinicius Costa Gomes
2011-07-06 20:10 ` [PATCH BlueZ v2 4/9] Define macros for link key types Vinicius Costa Gomes
2011-07-06 20:10 ` [PATCH BlueZ v2 5/9] Fix using "magic" values for " Vinicius Costa Gomes
2011-07-06 20:10 ` [PATCH BlueZ v2 6/9] Fix memory leak when loading keys Vinicius Costa Gomes
2011-07-07  8:35   ` Marcel Holtmann
2011-07-07 11:01     ` Anderson Lizardo
2011-07-06 20:10 ` [PATCH BlueZ v2 7/9] Add support for getting the Encryption Key Size via btio Vinicius Costa Gomes
2011-07-06 20:10 ` [PATCH BlueZ v2 8/9] Add support for passing the CID to btiotest Vinicius Costa Gomes
2011-07-06 20:10 ` [PATCH BlueZ v2 9/9] Add support for btiotest to returning the key size Vinicius Costa Gomes

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=1310027300.21109.55.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=vinicius.gomes@openbossa.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