[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZwVo3AfFlAAuoTQF@black.fi.intel.com>
Date: Tue, 8 Oct 2024 20:16:12 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Frank Li <Frank.li@....com>
Cc: Vinod Koul <vkoul@...nel.org>, Paul Cercueil <paul@...pouillou.net>,
dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>
Subject: Re: [PATCH v1 3/4] dmaengine: Add a comment on why it's okay when
kasprintf() fails
On Mon, Oct 07, 2024 at 11:51:14AM -0400, Frank Li wrote:
> On Mon, Oct 07, 2024 at 06:06:47PM +0300, Andy Shevchenko wrote:
> > In dma_request_chan() one of the kasprintf() call is not checked
> > against NULL. This is completely fine right now, but make others
> > aware of this aspect by adding a comment.
>
> suggest:
>
> Add comment in dma_request_chan() to clarify kasprintf() missing return
> value check and it is correct funcationaly.
Sure, thanks.
...
> > #ifdef CONFIG_DEBUG_FS
> > - chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev),
> > - name);
> > + chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), name);
> > + /* No functional issue if it fails, users are supposed to test before use */
>
> comments should above chan->dbg_client_name ...
It's placed exactly there on purpose. Because it explains
> No funcational issue if it is NULL because user always test it before use.
I think my is better because it reveals the actual issue, ideally users
must not rely on that and the code here should assign a valid pointer.
The problem is that the code paths are a bit twisted and I only can come
up with this comment _for now_. Semantically this change is a band-aid
(and not good), but at least it describes current (broken) desing.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists