From: "Dirk-Jan C. Binnema" <djcb.bulk@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: "Dirk-Jan C. Binnema" <djcb@djcbsoftware.nl>
Subject: [PATCH 1/3] Update gatt_service_add size assert for dealing with 128-bit uuids
Date: Mon, 29 Jul 2013 11:42:48 -0700 [thread overview]
Message-ID: <1375123370-20055-1-git-send-email-djcb.bulk@gmail.com> (raw)
From: "Dirk-Jan C. Binnema" <djcb@djcbsoftware.nl>
To paraphrase Anderson Lizardo: "h" was overflowing for 128-bit services
because the handle is incremented after each attribute is added so at the
end we had: 0xffff + 1 == 0 (h is uint16_t).
As it seems more complex to try to remove the overflow without
affecting the logic too much, we update the assertion.
---
attrib/gatt-service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/attrib/gatt-service.c b/attrib/gatt-service.c
index 4b02d39..1b84c89 100644
--- a/attrib/gatt-service.c
+++ b/attrib/gatt-service.c
@@ -341,7 +341,7 @@ gboolean gatt_service_add(struct btd_adapter *adapter, uint16_t uuid,
}
g_assert(size < USHRT_MAX);
- g_assert(h - start_handle == (uint16_t) size);
+ g_assert(h == 0 || (h - start_handle == (uint16_t) size));
g_slist_free_full(chrs, free_gatt_info);
return TRUE;
--
1.8.1.4
next reply other threads:[~2013-07-29 18:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-29 18:42 Dirk-Jan C. Binnema [this message]
2013-07-29 18:42 ` [PATCH 2/3] Rename GATT_OPT_CHR_UUID into GATT_OPT_CHR_UUID16 Dirk-Jan C. Binnema
2013-07-29 18:42 ` [PATCH 3/3] Add support for 128-bit characteristic uuids in gatt_service_add Dirk-Jan C. Binnema
2013-07-30 11:28 ` [PATCH 1/3] Update gatt_service_add size assert for dealing with 128-bit uuids 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=1375123370-20055-1-git-send-email-djcb.bulk@gmail.com \
--to=djcb.bulk@gmail.com \
--cc=djcb@djcbsoftware.nl \
--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