From: Szymon Janc <szymon.janc@tieto.com>
To: Anderson Lizardo <anderson.lizardo@openbossa.org>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [RFC 03/15] sdp: Use helper functions instead of bt_get_unaligned macro
Date: Fri, 31 Aug 2012 13:49:52 +0200 [thread overview]
Message-ID: <2567651.ypxvMR3dxG@uw000953> (raw)
In-Reply-To: <CAJdJm_NpsHV77wKHd9RkCoVKoYt1RRaOQbLaXt_fCJ9tS3mcwQ@mail.gmail.com>
On Friday 31 of August 2012 13:55:08 Anderson Lizardo wrote:
> Hi Szymon,
Hi Anderson,
>
> On Fri, Aug 31, 2012 at 4:36 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
> > This fix number of compilation errors on ARM similar to one below.
> >
> > lib/sdp.c: In function 'sdp_uuid_extract':
> > lib/sdp.c:1019:27: error: cast increases required alignment
> > of target type [-Werror=cast-align]
> > lib/sdp.c:1019:27: error: cast increases required alignment
> > of target type [-Werror=cast-align]
> > lib/sdp.c:1026:27: error: cast increases required alignment
> > of target type [-Werror=cast-align]
> > lib/sdp.c:1026:27: error: cast increases required alignment
> > of target type [-Werror=cast-align]
> >
> > Change-Id: I587fb99328d7e5b9053af81597bd48b3a4e610ad
>
> You should remove the "Change-Id" tags from your patches.
Crap. Will remove it in V2 :)
>
> > case SDP_INT16:
> > - d->val.int16 = bt_get_unaligned((int16_t *) value);
> > + d->val.int16 = bt_get_16(value);
> > d->unitSize += sizeof(int16_t);
> > break;
>
> Is this safe? You are assigning a unsigned type (return value from
> bt_get_16()) to a signed one. Same applies for SDP_INT32 and SDP_INT64
Mixing signed and unsigned could introduce some problem when you interpret data (e.g. in
comparison), but here value will be simply assigned.
I could add an explicit cast here (as this might bother some lint-like tools) if you prefer.
>
> > @@ -1427,7 +1427,7 @@ sdp_record_t *sdp_extract_pdu(const uint8_t *buf, int bufsize, int *scanned)
> > }
> >
> > dtd = *(uint8_t *) p;
> > - attr = ntohs(bt_get_unaligned((uint16_t *) (p + n)));
> > + attr = bt_get_be16((p + n));
>
> Extra parenthesis can be dropped.
Will fix.
>
> Regards,
>
--
BR
Szymon Janc
next prev parent reply other threads:[~2012-08-31 11:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-31 8:36 [RFC 00/15] Unaligned memory access fixes Szymon Janc
2012-08-31 8:36 ` [RFC 01/15] lib: Add host order unaligned access functions Szymon Janc
2012-08-31 8:36 ` [RFC 02/15] sap-u8500: Fix compile error due to unaligned memory access Szymon Janc
2012-08-31 8:36 ` [RFC 03/15] sdp: Use helper functions instead of bt_get_unaligned macro Szymon Janc
2012-08-31 10:55 ` Anderson Lizardo
2012-08-31 11:49 ` Szymon Janc [this message]
2012-08-31 12:12 ` Anderson Lizardo
2012-08-31 16:14 ` Marcel Holtmann
2012-09-03 7:06 ` Szymon Janc
2012-09-03 9:57 ` Johan Hedberg
2012-09-03 10:28 ` Szymon Janc
2012-08-31 8:36 ` [RFC 04/15] Add helper functions for putting integers on unaligned memory address Szymon Janc
2012-08-31 8:36 ` [RFC 05/15] sdp: Fix compilation errors due to unaligned memory access Szymon Janc
2012-08-31 8:36 ` [RFC 06/15] l2test: " Szymon Janc
2012-08-31 8:36 ` [RFC 07/15] rctest: " Szymon Janc
2012-08-31 8:36 ` [RFC 08/15] monitor: " Szymon Janc
2012-08-31 8:36 ` [RFC 09/15] scotest: " Szymon Janc
2012-08-31 8:36 ` [RFC 10/15] avrcp: " Szymon Janc
2012-08-31 8:36 ` [RFC 11/15] sap: " Szymon Janc
2012-08-31 8:36 ` [RFC 12/15] adaptername: Refactor handle_inotify_cb Szymon Janc
2012-08-31 8:36 ` [RFC 13/15] sdpd-request: Fix build errors due to unaligned memory access Szymon Janc
2012-08-31 8:36 ` [RFC 14/15] sdpd-service: " Szymon Janc
2012-08-31 8:36 ` [RFC 15/15] hciemu: " Szymon Janc
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=2567651.ypxvMR3dxG@uw000953 \
--to=szymon.janc@tieto.com \
--cc=anderson.lizardo@openbossa.org \
--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