• J
    Bluetooth: Fix false-positive "uninitialized" compiler warning · 580039e8
    Johan Hedberg 提交于
    Some gcc versions don't seem to be able to properly track the flow of
    the smp_cmd_pairing_random() function and end up causing the following
    types of (false-positive) warnings:
    
     smp.c:1995:6: warning: ‘nb’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       err = smp_g2(smp->tfm_cmac, pkax, pkbx, na, nb, &passkey);
     smp.c:1995:6: warning: ‘na’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       err = smp_g2(smp->tfm_cmac, pkax, pkbx, na, nb, &passkey);
           ^
     smp.c:1995:6: warning: ‘pkbx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       err = smp_g2(smp->tfm_cmac, pkax, pkbx, na, nb, &passkey);
           ^
     smp.c:1995:6: warning: ‘pkax’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       err = smp_g2(smp->tfm_cmac, pkax, pkbx, na, nb, &passkey);
    
    This patch fixes the issue by moving the pkax/pkbx and na/nb
    initialization earlier in the function.
    Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
    Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
    580039e8
smp.c 72.1 KB