summaryrefslogtreecommitdiff
path: root/drivers/nfc/st-nci
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-07-23 17:11:51 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-06 10:19:32 +0200
commit65d02dfa34bf1be620c42dd0faf011a2bf91e20f (patch)
treedffc8162be08cbad049c66925944a414bdd1f18e /drivers/nfc/st-nci
parent69f0dd8bc10f14dbfb76bc54e7dac9daab548a98 (diff)
st_nci_hci_connectivity_event_received: null check the allocation
[ Upstream commit 3008e06fdf0973770370f97d5f1fba3701d8281d ] devm_kzalloc may fail and return NULL. So the null check is needed. Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/nfc/st-nci')
-rw-r--r--drivers/nfc/st-nci/se.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nfc/st-nci/se.c b/drivers/nfc/st-nci/se.c
index 56f2112e0cd8..85df2e009310 100644
--- a/drivers/nfc/st-nci/se.c
+++ b/drivers/nfc/st-nci/se.c
@@ -344,6 +344,8 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,
transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev,
skb->len - 2, GFP_KERNEL);
+ if (!transaction)
+ return -ENOMEM;
transaction->aid_len = skb->data[1];
memcpy(transaction->aid, &skb->data[2], transaction->aid_len);