Commit: 32641ce15e4e18196fa63a307e1f56a11e6095e4
Parent: 3f7d7f6db5872dfae71c0c858ac1522e5f5697c0
Author: Miao-chen Chou <mcchou@chromium.org>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2016-12-22 12:42:16
Tree: de57c40aa0e313b5774a65ec10e9e05728a16131

monitor/rfcomm: Fix a potential memory access issue for compatibility with LLVM This patch removes "packed" attribute from the definition of struct rfcomm_rpn to prevent the access to an unaligned struct member in mmc_rpn(). This patch also introduces a temp variable in mcc_pn() to prevent unaligned access without touching the definition of struct rfcomm_pn, since struct rfcomm_pn is used as a PDU. error messages from LLVM build: monitor/rfcomm.c:238:36: error: taking address of packed member 'pm' of class or structure 'rfcomm_rpn' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] if (!l2cap_frame_get_le16(frame, &rpn.pm)) monitor/rfcomm.c:287:36: error: taking address of packed member 'mtu' of class or structure 'rfcomm_pn' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] if (!l2cap_frame_get_le16(frame, &pn.mtu)) Currently there is no corresponding flag in GCC to generate the same error messages. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628.

Diffstat

M monitor/rfcomm.c | 5 ++++-

1 files changed, 4 insertions(+), 1 deletions(-)

View Full Diff | Patch