linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Zhu Jun <zhujun2@cmss.chinamobile.com>,
	linux-mm@kvack.org, kernel-janitors@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tools/mm: Use calloc and check the potential memory allocation failure
Date: Thu, 29 Aug 2024 08:25:45 +0200	[thread overview]
Message-ID: <716f7466-562d-4bbe-a8ec-851a0b289db5@web.de> (raw)
In-Reply-To: <20240829055621.3890-1-zhujun2@cmss.chinamobile.com>

> Replace malloc with calloc and add memory allocating check

                      memset(…, 0, …) call by calloc()?


> of comm_str before used.

* Add also a null pointer check for the detection of a memory allocation failure.

* Would you like to improve such a change description another bit
  (with tags like “Fixes” and “Cc”)?

* How do you think about to omit the statement “fprintf(stderr, "Out of memory\n");”?

* I suggest to omit the word “potential” from the summary phrase.


Regards,
Markus


  reply	other threads:[~2024-08-29  6:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29  5:56 Zhu Jun
2024-08-29  6:25 ` Markus Elfring [this message]
2024-08-29  7:39   ` Dev Jain
2024-08-29  7:55     ` Markus Elfring
2024-08-29  8:14       ` Dev Jain

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=716f7466-562d-4bbe-a8ec-851a0b289db5@web.de \
    --to=markus.elfring@web.de \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zhujun2@cmss.chinamobile.com \
    /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