All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ] monitor: Improbe decoding of ATT Read by Group Type Respose
Date: Sun, 24 May 2015 16:58:41 +0300	[thread overview]
Message-ID: <20150524135841.GA10688@t440s> (raw)
In-Reply-To: <1432473311-16657-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Sun, May 24, 2015, Luiz Augusto von Dentz wrote:
> +static void print_group_list(const char *label, uint8_t length,
> +					const void *data, uint16_t size)
> +{
> +	uint8_t count;
> +
> +	if (length == 0)
> +		return;
> +
> +	count = size / length;
> +
> +	print_field("%s: %u entr%s", label, count, count == 1 ? "y" : "ies");
> +
> +	while (size >= length) {
> +		print_handle_range("Handle range", data);
> +		print_uuid("UUID", data + 4, length - 4);
> +
> +		data += length;
> +		size -= length;
> +	}
> +
> +	packet_hexdump(data, size);
> +}

Looks good, but to avoid btmon crashes (e.g. when analyzing codenomicon
logs) might be good to add check for 'length >= 6' and jump to
packet_hexdump if you get something smaller than that.

Johan

  reply	other threads:[~2015-05-24 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-24 13:15 [PATCH BlueZ] monitor: Improbe decoding of ATT Read by Group Type Respose Luiz Augusto von Dentz
2015-05-24 13:58 ` Johan Hedberg [this message]
2015-05-24 15:12   ` Luiz Augusto von Dentz
2015-05-24 15:29     ` Johan Hedberg
2015-05-24 15:32 ` Johan Hedberg

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=20150524135841.GA10688@t440s \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.