From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Fuqian Huang <huangfq.daxian@gmail.com>
Cc: Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 25/27] kernel: power: use kzalloc rather than kmalloc followed with memset
Date: Fri, 28 Jun 2019 12:16:36 +0200 [thread overview]
Message-ID: <1609978.ayZxNtafmO@kreacher> (raw)
In-Reply-To: <20190628025036.16135-1-huangfq.daxian@gmail.com>
On Friday, June 28, 2019 4:50:35 AM CEST Fuqian Huang wrote:
> Use zeroing allocator instead of using allocator
> followed with memset with 0
>
> Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
> ---
> kernel/power/swap.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/power/swap.c b/kernel/power/swap.c
> index e1912ad13bdc..ca0fcb5ced71 100644
> --- a/kernel/power/swap.c
> +++ b/kernel/power/swap.c
> @@ -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)
>
Queued up for 5.3 with minor subject changes. Thanks!
prev parent reply other threads:[~2019-06-28 10:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 2:50 [PATCH v2 25/27] kernel: power: use kzalloc rather than kmalloc followed with memset Fuqian Huang
2019-06-28 10:16 ` Rafael J. Wysocki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1609978.ayZxNtafmO@kreacher \
--to=rjw@rjwysocki.net \
--cc=huangfq.daxian@gmail.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox