lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 26 Jun 2024 11:07:33 +0200
From: Michael Nazzareno Trimarchi <michael@...rulasolutions.com>
To: Peng Fan <peng.fan@....com>
Cc: Ma Ke <make24@...as.ac.cn>, "vkoul@...nel.org" <vkoul@...nel.org>, 
	"shawnguo@...nel.org" <shawnguo@...nel.org>, "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>, 
	"kernel@...gutronix.de" <kernel@...gutronix.de>, "festevam@...il.com" <festevam@...il.com>, 
	"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>, 
	"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>, 
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dmaengine: mxs-dma: Add check for dma_set_max_seg_size in mxs_dma_probe()

Hi

On Wed, Jun 26, 2024 at 11:02 AM Peng Fan <peng.fan@....com> wrote:
>
> > Subject: [PATCH] dmaengine: mxs-dma: Add check for
> > dma_set_max_seg_size in mxs_dma_probe()
>
> Please read
> https://lore.kernel.org/all/ZiocjS6tbeTt2mPD@matsya/
>
> Regards,
> Peng.
>
> >
> > As the possible failure of the dma_set_max_seg_size(), we should
> > better check the return value of the dma_set_max_seg_size().
> >
> > Fixes: a580b8c5429a ("dmaengine: mxs-dma: add dma support for
> > i.MX23/28")
> > Signed-off-by: Ma Ke <make24@...as.ac.cn>
> > ---
> >  drivers/dma/mxs-dma.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index
> > cfb9962417ef..90cbb9b04b02 100644
> > --- a/drivers/dma/mxs-dma.c
> > +++ b/drivers/dma/mxs-dma.c
> > @@ -798,7 +798,9 @@ static int mxs_dma_probe(struct
> > platform_device *pdev)
> >       mxs_dma->dma_device.dev = &pdev->dev;
> >
> >       /* mxs_dma gets 65535 bytes maximum sg size */
> > -     dma_set_max_seg_size(mxs_dma->dma_device.dev,
> > MAX_XFER_BYTES);
> > +     ret = dma_set_max_seg_size(mxs_dma->dma_device.dev,
> > MAX_XFER_BYTES);
> > +     if (ret)
> > +             return ret;
> >

If the function returns an error then you should check for it. If it's
not logical to have it, then you could
make void the function that is called and WARN_ON on an illogical situation

Michael

> >       mxs_dma->dma_device.device_alloc_chan_resources =
> > mxs_dma_alloc_chan_resources;
> >       mxs_dma->dma_device.device_free_chan_resources =
> > mxs_dma_free_chan_resources;
> > --
> > 2.25.1
> >
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ