Re: [PATCH BlueZ v2 2/9] Add support for storing SMP keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux