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