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: Iulia Manda <iulia.manda21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
if (!wrq->pointer)
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)
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) {
kfree(sock);
return -ENOMEM;