public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: yi'bin ding <yibin.ding01@gmail.com>
Cc: Yibin Ding <Yibin.Ding@unisoc.com>,
	djakov@kernel.org, rafael@kernel.org, niuzhiguo84@gmail.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hao_hao.Wang@unisoc.com, Ke.Wang@unisoc.com
Subject: Re: [PATCH 1/2] interconnect: Add character pointer initialization
Date: Mon, 2 Sep 2024 08:10:05 +0200	[thread overview]
Message-ID: <2024090244-showpiece-backboned-4aa5@gregkh> (raw)
In-Reply-To: <CAC6ZDY_V1w92gg=ZugbHhWfBJpVqNpuTdgvURk0WYVnzqMKkjA@mail.gmail.com>

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Mon, Sep 02, 2024 at 11:03:29AM +0800, yi'bin ding wrote:
> Thanks in advance,
> 
> Why is this needed?  Why not just use the size of the structure?
> 
> answer:Because the memory allocated here is not actually used, it is just
> to prevent the occurrence of null pointer.In order to prevent memory waste,
> I applied for a small amount of memory as possible. If necessary, I can
> submit another revision to change it to the size of the structure or just
> to "1" without the macro definition.

Make it correct please.

> What commit id does this fix?
> 
> answer:commit id:770c69f037c18cfaa37c3d6c6ef8bd257635513f (interconnect:
> Add debugfs test client)
> This commit creates some debugfs nodes, where the src_node and dst_node
> character pointers are not initialized. This will result in accessing null
> pointers when accessing them directly.

Please put the proper Fixes: tag in the changelog text then.

> And where are you freeing this memory you just allocated?
> 
> answer:The memory allocated here will be released when data is written to
> the node. The write operation will call debugfs_write_file_str() function,
> in which a new piece of memory will be allocated to save the new data, and
> then the old memory will be released.

That happens if you write to the file, but what happens if you never
write to the file?  What happens when you remove the driver/module,
shouldn't you free the memory then as well?

thanks,

greg k-h

  parent reply	other threads:[~2024-09-02  6:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-30 10:22 [PATCH 1/2] interconnect: Add character pointer initialization Yibin Ding
2024-08-30 10:35 ` Greg KH
     [not found]   ` <CAC6ZDY_V1w92gg=ZugbHhWfBJpVqNpuTdgvURk0WYVnzqMKkjA@mail.gmail.com>
2024-09-02  6:10     ` Greg KH [this message]
     [not found]       ` <CAC6ZDY8KuBV5YDFJayCELkPEf6w_cMttEfa5fgQW85Zs9UnQtQ@mail.gmail.com>
2024-09-03  8:00         ` Greg KH

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=2024090244-showpiece-backboned-4aa5@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=Hao_hao.Wang@unisoc.com \
    --cc=Ke.Wang@unisoc.com \
    --cc=Yibin.Ding@unisoc.com \
    --cc=djakov@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=niuzhiguo84@gmail.com \
    --cc=rafael@kernel.org \
    --cc=yibin.ding01@gmail.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