Skip to content

Commit 0d9b41d

Browse files
krzkdavem330
authored andcommitted
nfc: llcp: fix possible use of uninitialized variable in nfc_llcp_send_connect()
If sock->service_name is NULL, the local variable service_name_tlv_length will not be assigned by nfc_llcp_build_tlv(), later leading to using value frmo the stack. Smatch warning: net/nfc/llcp_commands.c:442 nfc_llcp_send_connect() error: uninitialized symbol 'service_name_tlv_length'. Fixes: de9e5ae ("NFC: llcp: Fix usage of llcp_add_tlv()") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d1e4632 commit 0d9b41d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/nfc/llcp_commands.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
390390
const u8 *service_name_tlv = NULL;
391391
const u8 *miux_tlv = NULL;
392392
const u8 *rw_tlv = NULL;
393-
u8 service_name_tlv_length, miux_tlv_length, rw_tlv_length, rw;
393+
u8 service_name_tlv_length = 0;
394+
u8 miux_tlv_length, rw_tlv_length, rw;
394395
int err;
395396
u16 size = 0;
396397
__be16 miux;

0 commit comments

Comments
 (0)