diff options
author | Navid Emamdoost <navid.emamdoost@gmail.com> | 2019-07-24 01:11:51 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-29 09:26:38 +0300 |
commit | 3e5e5f149dbfe86cab537d13591abe9826c12a3b (patch) | |
tree | c48f3a252d0b018cc187cac1bf93d314b024c444 /drivers/nfc/st-nci/se.c | |
parent | dd8f6058951ab4d90bbc2e4f10fee73f01a7bb1c (diff) | |
download | linux-3e5e5f149dbfe86cab537d13591abe9826c12a3b.tar.xz |
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/se.c')
-rw-r--r-- | drivers/nfc/st-nci/se.c | 2 |
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); |