Re: [PATCH 8/9] Read measurement interval characteristic

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

 



Hi Santiago,

On Thu, Sep 29, 2011, Santiago Carot-Nemesio wrote:
> @@ -148,7 +192,31 @@ static void read_temp_type_cb(guint8 status, const guint8 *pdu, guint16 len,
>  static void read_interval_cb(guint8 status, const guint8 *pdu, guint16 len,
>  							gpointer user_data)
>  {
> -	/* TODO */
> +	struct characteristic *ch = user_data;
> +	uint8_t value[ATT_MAX_MTU];
> +	uint16_t *p, interval;
> +	int vlen;
> +
> +	if (status != 0) {
> +		DBG("Measurement Interval value read failed: %s",
> +							att_ecode2str(status));
> +		return;
> +	}
> +
> +	if (!dec_read_resp(pdu, len, value, &vlen)) {
> +		DBG("Protocol error\n");
> +		return;
> +	}
> +
> +	if (vlen < 2) {
> +		DBG("Invalid Interval received");
> +		return;
> +	}
> +
> +	p = (uint16_t *) value;
> +	interval = btohs(*p);

This looks like a potential unaligned access issue. Probably safer to
use bt_get_unaligned here.

Johan
--
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