summaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp_core.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-02-25 09:18:10 +0800
committerSamuel Ortiz <sameo@linux.intel.com>2014-03-14 20:19:08 +0100
commit3143a4ca610d6a3de0d8814ee6f5f7da6fc7fbfa (patch)
tree434e24069b2b015d49981b8d11314e905c1966c6 /net/nfc/llcp_core.c
parent365a721adbdfe5f6577a66b9b74c12dc98fbb4a3 (diff)
downloadtalos-op-linux-3143a4ca610d6a3de0d8814ee6f5f7da6fc7fbfa.tar.gz
talos-op-linux-3143a4ca610d6a3de0d8814ee6f5f7da6fc7fbfa.zip
NFC: Move checking valid gb_len value to nfc_llcp_set_remote_gb
This checking is common for all caller, so move the checking to one place. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp_core.c')
-rw-r--r--net/nfc/llcp_core.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c
index 9d37dedec906..0cf9d4f45e6a 100644
--- a/net/nfc/llcp_core.c
+++ b/net/nfc/llcp_core.c
@@ -609,14 +609,16 @@ u8 *nfc_llcp_general_bytes(struct nfc_dev *dev, size_t *general_bytes_len)
int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len)
{
- struct nfc_llcp_local *local = nfc_llcp_find_local(dev);
+ struct nfc_llcp_local *local;
+
+ if (gb_len < 3 || gb_len > NFC_MAX_GT_LEN)
+ return -EINVAL;
+ local = nfc_llcp_find_local(dev);
if (local == NULL) {
pr_err("No LLCP device\n");
return -ENODEV;
}
- if (gb_len < 3)
- return -EINVAL;
memset(local->remote_gb, 0, NFC_MAX_GT_LEN);
memcpy(local->remote_gb, gb, gb_len);
OpenPOWER on IntegriCloud