Skip to content

Commit

Permalink
nfc: llcp: fix possible use of uninitialized variable in nfc_llcp_sen…
Browse files Browse the repository at this point in the history
…d_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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
krzk authored and davem330 committed May 15, 2023
1 parent d1e4632 commit 0d9b41d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/nfc/llcp_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
const u8 *service_name_tlv = NULL;
const u8 *miux_tlv = NULL;
const u8 *rw_tlv = NULL;
u8 service_name_tlv_length, miux_tlv_length, rw_tlv_length, rw;
u8 service_name_tlv_length = 0;
u8 miux_tlv_length, rw_tlv_length, rw;
int err;
u16 size = 0;
__be16 miux;
Expand Down

0 comments on commit 0d9b41d

Please sign in to comment.