Re: [PATCH] firmware: tegra: bpmp: Fix freeing uninitialized pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Krzysztof,

Thank you for the explanation and sorry for not realizing the correct
deallocation function.

I found in another email thread that the NULL initialization following
the __free() was mainly for readability but not safety. Sorry for the
confusion.

We are working on a static analysis tool and wanted to report
potential bugs. We directly sent a patch trying to reduce developer’s
burden but didn’t not realize the correct use of Reported-by tag. We
will be more careful in the future.

Best,
Zichen

On Tue, Oct 1, 2024 at 3:13 PM Krzysztof Kozlowski
<krzysztof.kozlowski@xxxxxxxxxx> wrote:
>
> On 01/10/2024 22:09, Zichen Xie wrote:
> > I don't think device_node() is a correct freeing function here:
> > 'struct device_node *np __free(device_node);'
> > even if I'm not an expert in Kernel.
> >
> > And I think it could be more convincing to explain 'why', rather than
> > simply highlighting the errors repeatedly.
>
> If you ever bothered to compile your code, you would see why.
>
> None of your arguments make any sense. Your code tries to perform
> initialization, just before assignment so it is completely unnecessary.
> I don't understand why you could not spot that obvious part of the code,
> because this is just C. For obvious reasons I won't be spending my time
> to explain why this:
>
> some_ptr *ptr = NULL;
> ptr = foo;
> if () ...
>    return ...;
>
> is wrong. You just did not read the code, not built it.
>
> Best regards,
> Krzysztof
>





[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux