From: Marcel Holtmann Date: Sun, 11 Jan 2015 23:18:17 +0000 (-0800) Subject: Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_hci X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b0a8e282b54d11859a13bebd4c056dcfb577f8b7;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_hci This adds an extra check for ensuring that the size of sockaddr_hci does not grow larger than sockaddr. Signed-off-by: Marcel Holtmann Signed-off-by: Johan Hedberg --- diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 2c245fdf319a..e176a988625e 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -1230,6 +1230,8 @@ int __init hci_sock_init(void) { int err; + BUILD_BUG_ON(sizeof(struct sockaddr_hci) > sizeof(struct sockaddr)); + err = proto_register(&hci_sk_proto, 0); if (err < 0) return err;