From: Simon Que Date: Thu, 17 Jan 2013 00:19:26 +0000 (-0800) Subject: CHROMIUM: bluetooth: initialize rfc struct in l2cap_core.c X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=390e7e94ee1ee59222fb0a30bfa0e23b8ac0b4d6;p=people%2Faperard%2Flinux-chromebook.git CHROMIUM: bluetooth: initialize rfc struct in l2cap_core.c Removes warnings: warning: 'rfc.max_pdu_size' may be used uninitialized in this function warning: 'rfc.monitor_timeout' may be used uninitialized in this function warning: 'rfc.retrans_timeout' may be used uninitialized in this function warning: 'rfc.mode' may be used uninitialized in this function This is based on (but not compatible with) an upstream patch: c20f8e35ca8b0583323d310ec63a0f0d17cfdcf5 This patch can be discarded when moving to kernel-next BUG=chromium-os:5542 TEST=emerge chromeos-kernel, make sure l2cap_core has no warnings Change-Id: I564eca4421a6c4f8f4dcddfacd56e0d574885596 Signed-off-by: Simon Que Reviewed-on: https://gerrit.chromium.org/gerrit/41481 Reviewed-by: Scott James Remnant Reviewed-by: Mandeep Singh Baines --- diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 6f9c25b633a60..41f4cd384339c 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -2573,7 +2573,15 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len) { int type, olen; unsigned long val; - struct l2cap_conf_rfc rfc; + /* Initialize to sane default values in case a misbehaving remote device + * does not send an RFC option later. + */ + struct l2cap_conf_rfc rfc = { + .mode = chan->mode, + .retrans_timeout = cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO), + .monitor_timeout = cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO), + .max_pdu_size = cpu_to_le16(chan->imtu), + }; BT_DBG("chan %p, rsp %p, len %d", chan, rsp, len); @@ -2591,14 +2599,6 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len) } } - /* Use sane default values in case a misbehaving remote device - * did not send an RFC option. - */ - rfc.mode = chan->mode; - rfc.retrans_timeout = cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO); - rfc.monitor_timeout = cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO); - rfc.max_pdu_size = cpu_to_le16(chan->imtu); - BT_ERR("Expected RFC option was not found, using defaults"); done: