linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: XU pengfei <xupengfei@nfschina.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/1] mm/mmap_lock: Remove unnecessary 'NULL' values from Pointer
Date: Sat, 8 Oct 2022 20:21:21 +0800	[thread overview]
Message-ID: <45e6ce25-f0b6-4461-b88d-5b6bb78cabba@huawei.com> (raw)
In-Reply-To: <20221008093942.3982-1-xupengfei@nfschina.com>

On 2022/10/8 17:39, XU pengfei wrote:
> Pointer variables allocate memory first, and then judge. There is no
> need to initialize the assignment.
> 
> Signed-off-by: XU pengfei <xupengfei@nfschina.com>
> ---
>  mm/mmap_lock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
> index 1854850b4b89..65a57731aa15 100644
> --- a/mm/mmap_lock.c
> +++ b/mm/mmap_lock.c
> @@ -198,7 +198,7 @@ void trace_mmap_lock_unreg(void)
>   */
>  static const char *get_mm_memcg_path(struct mm_struct *mm)
>  {
> -	char *buf = NULL;
> +	char *buf;
>  	struct mem_cgroup *memcg = get_mem_cgroup_from_mm(mm);
>  
>  	if (memcg == NULL)

It seems if memcg == NULL, the code will go to out and return uninitialized @buf?

Thanks,
Miaohe Lin






  reply	other threads:[~2022-10-08 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-08  9:39 XU pengfei
2022-10-08 12:21 ` Miaohe Lin [this message]
2022-10-08 13:14 ` kernel test robot
2022-10-09  3:41 XU pengfei

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=45e6ce25-f0b6-4461-b88d-5b6bb78cabba@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xupengfei@nfschina.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