Re: [PATCH 43/87] kernel: power: replace kmalloc and memset with kzalloc

From: Pavel Machek
Date: Thu Jun 27 2019 - 15:56:13 EST


On Fri 2019-06-28 01:40:48, Fuqian Huang wrote:
> kmalloc + memset(0) -> kzalloc
>
> Signed-off-by: Fuqian Huang <huangfq.daxian@xxxxxxxxx>

Acked-by: Pavel Machek <pavel@xxxxxx>

> @@ -974,12 +974,11 @@ static int get_swap_reader(struct swap_map_handle *handle,
> last = handle->maps = NULL;
> offset = swsusp_header->image;
> while (offset) {
> - tmp = kmalloc(sizeof(*handle->maps), GFP_KERNEL);
> + tmp = kzalloc(sizeof(*handle->maps), GFP_KERNEL);
> if (!tmp) {
> release_swap_reader(handle);
> return -ENOMEM;
> }
> - memset(tmp, 0, sizeof(*tmp));
> if (!handle->maps)
> handle->maps = tmp;
> if (last)

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature