aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/llcp')
-rw-r--r--net/nfc/llcp/llcp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 85bc75c38dea..746f5a2f9804 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -549,14 +549,13 @@ int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len)
549 pr_err("No LLCP device\n"); 549 pr_err("No LLCP device\n");
550 return -ENODEV; 550 return -ENODEV;
551 } 551 }
552 if (gb_len < 3)
553 return -EINVAL;
552 554
553 memset(local->remote_gb, 0, NFC_MAX_GT_LEN); 555 memset(local->remote_gb, 0, NFC_MAX_GT_LEN);
554 memcpy(local->remote_gb, gb, gb_len); 556 memcpy(local->remote_gb, gb, gb_len);
555 local->remote_gb_len = gb_len; 557 local->remote_gb_len = gb_len;
556 558
557 if (local->remote_gb == NULL || local->remote_gb_len == 0)
558 return -ENODEV;
559
560 if (memcmp(local->remote_gb, llcp_magic, 3)) { 559 if (memcmp(local->remote_gb, llcp_magic, 3)) {
561 pr_err("MAC does not support LLCP\n"); 560 pr_err("MAC does not support LLCP\n");
562 return -EINVAL; 561 return -EINVAL;