Return-Path: From: To: CC: , , Date: Fri, 5 Nov 2010 17:12:49 +0200 Subject: RE: [PATCH 3/4] Sim Access Profile Server Message-ID: <99B09243E1A5DA4898CDD8B700111448098BAE50F8@EXMB04.eu.tieto.com> References: <1288791271-13857-1-git-send-email-waldemar.rymarkiewicz@tieto.com> <1288791271-13857-4-git-send-email-waldemar.rymarkiewicz@tieto.com> <20101105100548.GB32149@jh-x301> In-Reply-To: <20101105100548.GB32149@jh-x301> Content-Type: multipart/mixed; boundary="_002_99B09243E1A5DA4898CDD8B700111448098BAE50F8EXMB04eutieto_" MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: --_002_99B09243E1A5DA4898CDD8B700111448098BAE50F8EXMB04eutieto_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =20 Hi Johan, >> + val =3D (uint16_t *) ¶m->val; >> + maxmsgsize =3D ntohs(*val); > >Is this unaligned access safe? In theory this is safe :) param-> val should be always aligned to 4 bytes = according to sap spec struct sap_parameter { uint8_t id; uint8_t reserved; uint16_t len; uint8_t val[0]; /* * Padding bytes 0-3 bytes */ } __attribute__ ((packed)); However, I tried maxmsgsize =3D ntohs(bt_get_unaligned((uint16_t *) ¶m->val)); and got gcc error: dereferencing type-punned pointer will break strict-alia= sing rules. Strange as it's already used in bluetoothd and it compiles without such err= ors. Do I missed something ? Thanks for comments and have a look on fixed patch. /Waldek= --_002_99B09243E1A5DA4898CDD8B700111448098BAE50F8EXMB04eutieto_ Content-Type: application/octet-stream; name="0003-Sim-Access-Profile-Server.patch" Content-Description: 0003-Sim-Access-Profile-Server.patch Content-Disposition: attachment; filename="0003-Sim-Access-Profile-Server.patch"; size=48824; creation-date="Fri, 05 Nov 2010 16:24:44 GMT"; modification-date="Fri, 05 Nov 2010 16:24:44 GMT" Content-Transfer-Encoding: base64 RnJvbSBmMjlmZWJmY2E2YjJjM2ZhYWU2ZDhkOGE5YzUzYjkwZTVmNmQzOWE3IE1vbiBTZXAgM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gKmdlcnI7CisJYmRhZGRyX3Qgc3JjLCBk c3Q7CisJaW50IGVycjsKKworCWlmICghY2hhbiB8fCAhc2VydmVyKQorCQlyZXR1cm47CisKKwlp ZiAoc2VydmVyLT5pbykKKwkJZ290byBkcm9wOworCisJYnRfaW9fZ2V0KGNoYW4sIEJUX0lPX1JG Q09NTSwgJmdlcnIsCisJCQlCVF9JT19PUFRfU09VUkNFX0JEQUREUiwgJnNyYywKKwkJCUJUX0lP X09QVF9ERVNUX0JEQUREUiwgJmRzdCwKKwkJCUJUX0lPX09QVF9JTlZBTElEKTsKKwlpZiAoZ2Vy cikgeworCQllcnJvcigiJXMiLCBnZXJyLT5tZXNzYWdlKTsKKwkJZ19lcnJvcl9mcmVlKGdlcnIp OworCQlnb3RvIGRyb3A7CisJfQorCisJc2VydmVyLT5pbyA9IGdfaW9fY2hhbm5lbF9yZWYoY2hh bik7CisKKwllcnIgPSBidGRfcmVxdWVzdF9hdXRob3JpemF0aW9uKCZzcmMsICZkc3QsIFNBUF9V VUlELAorCQkJCQljb25uZWN0X2F1dGhfY2IsIHNlcnZlcik7CisKKwlpZiAoZXJyIDwgMCkgewor CQlEQkcoIkF1dGhvcml6YXRpb24gZGVuaWVkOiAlcyIsIHN0cmVycm9yKGVycikpOworCQlnb3Rv IGRyb3A7CisJfQorCisJREJHKCJTQVAgaW5jb21pbmcgY29ubmVjdGlvbiAoc29jayAlZCkgYXV0 aG9yaXphdGlvbi4iLAorCQkJCWdfaW9fY2hhbm5lbF91bml4X2dldF9mZChjaGFuKSk7CisKKwly ZXR1cm47CisKK2Ryb3A6CisJZ19pb19jaGFubmVsX3NodXRkb3duKGNoYW4sIFRSVUUsIE5VTEwp OworCWlmIChzZXJ2ZXItPmlvICYmIHNlcnZlci0+aW8gPT0gY2hhbikgeworCQlnX2lvX2NoYW5u ZWxfdW5yZWYoc2VydmVyLT5pbyk7CisJCXNlcnZlci0+aW8gPSBOVUxMOworCX0KK30KKworc3Rh dGljIGlubGluZSBEQ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