Commit de9e5aeb authored by Thierry Escande's avatar Thierry Escande Committed by Samuel Ortiz

NFC: llcp: Fix usage of llcp_add_tlv()

In functions using llcp_add_tlv(), a skb pointer could be set to NULL
and then reuse afterward.

With this patch, the skb pointer returned by llcp_add_tlv() is ignored
since it can only be the passed skb pointer or NULL when the passed TLV
is NULL. There is also no need to check for the TLV pointer as this is
done by llcp_add_tlv().
Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 204bddcb
...@@ -438,12 +438,9 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) ...@@ -438,12 +438,9 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
goto error_tlv; goto error_tlv;
} }
if (service_name_tlv != NULL) llcp_add_tlv(skb, service_name_tlv, service_name_tlv_length);
skb = llcp_add_tlv(skb, service_name_tlv, llcp_add_tlv(skb, miux_tlv, miux_tlv_length);
service_name_tlv_length); llcp_add_tlv(skb, rw_tlv, rw_tlv_length);
skb = llcp_add_tlv(skb, miux_tlv, miux_tlv_length);
skb = llcp_add_tlv(skb, rw_tlv, rw_tlv_length);
skb_queue_tail(&local->tx_queue, skb); skb_queue_tail(&local->tx_queue, skb);
...@@ -493,8 +490,8 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock) ...@@ -493,8 +490,8 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
goto error_tlv; goto error_tlv;
} }
skb = llcp_add_tlv(skb, miux_tlv, miux_tlv_length); llcp_add_tlv(skb, miux_tlv, miux_tlv_length);
skb = llcp_add_tlv(skb, rw_tlv, rw_tlv_length); llcp_add_tlv(skb, rw_tlv, rw_tlv_length);
skb_queue_tail(&local->tx_queue, skb); skb_queue_tail(&local->tx_queue, skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment