macsec: add missing NULL check after kmalloc

Fixes: c09440f7dc ("macsec: introduce IEEE 802.1AE driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Sabrina Dubroca 2016-04-22 11:28:01 +02:00 committed by David S. Miller
parent 3d05a06d31
commit 72f2a05b8f
1 changed files with 2 additions and 2 deletions

View File

@ -1622,8 +1622,8 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
} }
rx_sa = kmalloc(sizeof(*rx_sa), GFP_KERNEL); rx_sa = kmalloc(sizeof(*rx_sa), GFP_KERNEL);
if (init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), secy->key_len, if (!rx_sa || init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]),
secy->icv_len)) { secy->key_len, secy->icv_len)) {
rtnl_unlock(); rtnl_unlock();
return -ENOMEM; return -ENOMEM;
} }