greybus: operation: fix unaligned memory accesses in receive path
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 7 Apr 2015 09:27:13 +0000 (11:27 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 7 Apr 2015 15:31:05 +0000 (17:31 +0200)
commit564c72b1c6f753f562e42c2a30a5dc50c194be0f
tree28037b1aa0849d7d24a1346f4000b02e7e6eedf2
parentc15ccabe8105e2ef5e34e610c068e6f50ff08598
greybus: operation: fix unaligned memory accesses in receive path

The buffer received from our current host driver is 1-byte aligned and
will therefore cause unaligned memory accesses if simply cast to an
operation-message header.

Fix this by making a properly aligned copy of the header in
gb_connection_recv_response before accessing its fields.

Note that this does not affect protocol drivers as the whole buffer is
copied when creating the corresponding request or response before being
forwarded.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/operation.c