Re: [PATCH] scsi: fix uninitialized pointers with free attr

From: James Bottomley

Date: Wed Nov 19 2025 - 07:43:04 EST


On Wed, 2025-11-19 at 00:31 -0800, Christoph Hellwig wrote:
> On Wed, Nov 19, 2025 at 12:26:56PM +0530, ally heev wrote:
> > As per the ongoing discussion
> > https://lore.kernel.org/lkml/58fd478f408a34b578ee8d949c5c4b4da4d4f41d.camel@xxxxxxxxxxxxxxxxxxxxx/
> > , I believe there are no changes required here
>
> What about just dropping that __free thing that just make the code
> harder to read and more buggy?

It does? The original patch was this:

https://lore.kernel.org/linux-scsi/20240222214508.1630719-9-bvanassche@xxxxxxx/

It's part of the series adding Advice Hints, so we can't just revert it
because the sense buffer would be too small. Using __free to replace a
stack allocation looks like a nice use of the cleanup primitives: I
think if we removed the __free and added a kfree before each of the six
returns that would make the code more prone to bugs on its next update.

Regards,

James