提交 879ea7d3 编写于 作者: I Iulia Manda 提交者: Greg Kroah-Hartman

Staging:vt6656: Replace some kzalloc calls with kcalloc in iwctl.c

This replacement is justified by the fact that kcalloc could prevent integer
overflow resulted from the multiplications used in kzalloc.

The semantic patch that showed this suggestion is kzalloc.cocci
Signed-off-by: NIulia Manda <iulia.manda21@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0481dccb
...@@ -725,10 +725,10 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info, ...@@ -725,10 +725,10 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info,
if (!wrq->pointer) if (!wrq->pointer)
return -EINVAL; return -EINVAL;
sock = kzalloc(sizeof(struct sockaddr) * IW_MAX_AP, GFP_KERNEL); sock = kcalloc(IW_MAX_AP, sizeof(struct sockaddr), GFP_KERNEL);
if (sock == NULL) if (sock == NULL)
return -ENOMEM; return -ENOMEM;
qual = kzalloc(sizeof(struct iw_quality) * IW_MAX_AP, GFP_KERNEL); qual = kcalloc(IW_MAX_AP, sizeof(struct iw_quality), GFP_KERNEL);
if (qual == NULL) { if (qual == NULL) {
kfree(sock); kfree(sock);
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册