OSDN Git Service

fix uninitialized fields in tBTM_PM_PWR_MD structs
authorAdam Hampson <ahampson@google.com>
Fri, 16 May 2014 23:41:22 +0000 (16:41 -0700)
committerAdam Hampson <ahampson@google.com>
Fri, 16 May 2014 23:41:22 +0000 (16:41 -0700)
This could potentially cause BTM_SetPowerMode() to take an
incorrect code path.

Change-Id: Ibca83129fffb5fbb64372e991cc433de144d333d
Signed-off-by: Adam Hampson <ahampson@google.com>
stack/l2cap/l2c_csm.c

index 4e24c23..d8c4ed3 100644 (file)
@@ -1015,6 +1015,7 @@ static void l2c_csm_open (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
 #if BTM_PWR_MGR_INCLUDED == TRUE
         {
             tBTM_PM_PWR_MD settings;
+            memset((void*)&settings, 0, sizeof(settings));
             settings.mode = BTM_PM_MD_ACTIVE;
             BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p_ccb->p_lcb->remote_bd_addr, &settings);
         }
@@ -1038,6 +1039,7 @@ static void l2c_csm_open (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
 #if BTM_PWR_MGR_INCLUDED == TRUE
         {
             tBTM_PM_PWR_MD settings;
+            memset((void*)&settings, 0, sizeof(settings));
             settings.mode = BTM_PM_MD_ACTIVE;
             BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p_ccb->p_lcb->remote_bd_addr, &settings);
         }