diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-09 19:07:40 +0200 |
---|---|---|
committer | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-19 12:44:07 +0200 |
commit | b5c84a426d9ffda5e886f7620b286e2a4350ae87 (patch) | |
tree | dfd72b8ac7fffe5c4e1e2e7945465dbfe9b6efb2 | |
parent | 5bc99f62015a63df22f72ee9b9396e8881b17d2e (diff) | |
download | neard-b5c84a426d9ffda5e886f7620b286e2a4350ae87.tar.gz |
nfctype5: fix returning uninitialized stack value in t5_tag_is_ti_pro()
The return value was not initialized so if tag was not matching, random
stack value (usually true) was returned instead of false.
This fixes clang warning:
plugins/nfctype5.c:257:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if ((uid[5] == 0xc4) || (uid[5] == 0xc5))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
plugins/nfctype5.c:261:9: note: uninitialized use occurs here
return ret;
^~~
plugins/nfctype5.c:257:2: note: remove the 'if' if its condition is always true
if ((uid[5] == 0xc4) || (uid[5] == 0xc5))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
plugins/nfctype5.c:248:10: note: initialize the variable 'ret' to silence this warning
bool ret;
^
= false
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
-rw-r--r-- | plugins/nfctype5.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/nfctype5.c b/plugins/nfctype5.c index 0f90e55..eef2afe 100644 --- a/plugins/nfctype5.c +++ b/plugins/nfctype5.c @@ -245,7 +245,7 @@ static bool t5_tag_is_ti_std(struct near_tag *tag) static bool t5_tag_is_ti_pro(struct near_tag *tag) { uint8_t *uid; - bool ret; + bool ret = false; uid = near_tag_get_iso15693_uid(near_tag_get_adapter_idx(tag), near_tag_get_target_idx(tag)); |