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(a)canonical.com>
---
plugins/nfctype5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/nfctype5.c b/plugins/nfctype5.c
index 0f90e55ab268..eef2afe9f6d0 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));
--
2.27.0