Re: [PATCH V2 1/2] interconnect: Add character pointer initialization

From: Greg KH
Date: Sat Sep 14 2024 - 09:57:09 EST


On Sat, Sep 14, 2024 at 06:24:35PM +0800, Yibin Ding wrote:
> From: Yibin Ding <Yibin.ding@xxxxxxxxxx>
>
> When accessing a node whose data type is a character pointer and has not
> been initialized, a crash will occur due to accessing a null pointer. So
> it is necessary to add the operation of initializing the character pointer.
> Since the debugfs_write_file_str() function performs a kfree() operation
> on the node data, memory is allocated to the node pointer during
> initialization will be released when data is written to the node.

But if no data is ever written this ends up being a memory leak. Please
do not fix one bug just to introduce another one.

> Signed-off-by: Yibin Ding <Yibin.ding@xxxxxxxxxx>

also, your patches are not in a series together for some reason, and
there's no information below the --- line showing what changed from the
previous version where I pointed out this very problem :(

greg k-h