[PATCH] iommu/dart: Fix return code in apple_dart_domain_alloc_paging()
Jason Gunthorpe
jgg at ziepe.ca
Tue Oct 31 17:47:47 PDT 2023
On Mon, Oct 30, 2023 at 09:38:23AM -0300, Jason Gunthorpe wrote:
> On Mon, Oct 30, 2023 at 03:00:56PM +0300, Dan Carpenter wrote:
> > On Mon, Oct 30, 2023 at 08:56:50AM -0300, Jason Gunthorpe wrote:
> > > On Mon, Oct 30, 2023 at 12:03:12PM +0300, Dan Carpenter wrote:
> > > > The apple_dart_domain_alloc_paging() function is supposed to return NULL
> > > > on error. Returning an error pointer will lead to an Oops in
> > > > __iommu_domain_alloc().
> > > >
> > > > Fixes: 482feb5c6492 ("iommu/dart: Call apple_dart_finalize_domain() as part of alloc_paging()")
> > > > Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
> > > > ---
> > > > drivers/iommu/apple-dart.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>
> > >
> > > Really need to fix this so the function does return ERR_PTR..
> >
> > It's called as a function pointer. Changing that will create a
> > backporting hazard unless we rename the pointer or something.
>
> You can make that argument about almost any change in the kernel..
>
> IMHO we needed an annotation like __user/__iomem/etc to indicate
> ERR_PTR so at least there is some hope of trivially finding it.
I was thinking about this some more, I think I prefer we fix the core
code to accept the ERR_PTR and just start moving gently in that
direction. I was working on some other stuff and it is starting to get
really confusing that only this op is different.
I'll send a patch
Jason
More information about the linux-arm-kernel
mailing list