diff options
Diffstat (limited to 'net/nfc/llcp_commands.c')
-rw-r--r-- | net/nfc/llcp_commands.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c index 367d8c027101..2ceefa183cee 100644 --- a/net/nfc/llcp_commands.c +++ b/net/nfc/llcp_commands.c | |||
@@ -149,6 +149,10 @@ struct nfc_llcp_sdp_tlv *nfc_llcp_build_sdreq_tlv(u8 tid, char *uri, | |||
149 | 149 | ||
150 | pr_debug("uri: %s, len: %zu\n", uri, uri_len); | 150 | pr_debug("uri: %s, len: %zu\n", uri, uri_len); |
151 | 151 | ||
152 | /* sdreq->tlv_len is u8, takes uri_len, + 3 for header, + 1 for NULL */ | ||
153 | if (WARN_ON_ONCE(uri_len > U8_MAX - 4)) | ||
154 | return NULL; | ||
155 | |||
152 | sdreq = kzalloc(sizeof(struct nfc_llcp_sdp_tlv), GFP_KERNEL); | 156 | sdreq = kzalloc(sizeof(struct nfc_llcp_sdp_tlv), GFP_KERNEL); |
153 | if (sdreq == NULL) | 157 | if (sdreq == NULL) |
154 | return NULL; | 158 | return NULL; |