From: Marcel Holtmann Date: Sun, 11 Jan 2015 23:18:19 +0000 (-0800) Subject: Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_l2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dd6255588a56e755380b66275ff4f35a8243b64a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_l2 This adds an extra check for ensuring that the size of sockaddr_l2 does not grow larger than sockaddr. Signed-off-by: Marcel Holtmann Signed-off-by: Johan Hedberg --- diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index f65caf41953f..20206cd3acbc 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -1614,6 +1614,8 @@ int __init l2cap_init_sockets(void) { int err; + BUILD_BUG_ON(sizeof(struct sockaddr_l2) > sizeof(struct sockaddr)); + err = proto_register(&l2cap_proto, 0); if (err < 0) return err;