Re: [PATCH v1 1/5] memremap: Check for size parameter

From: Andy Shevchenko
Date: Wed Apr 15 2020 - 10:59:04 EST


On Sat, Nov 16, 2019 at 05:29:37PM +0100, Christoph Hellwig wrote:
> On Fri, Nov 15, 2019 at 08:00:40PM +0200, Andy Shevchenko wrote:
> > There is no use of memremap() to be called with size = 0.
> > Simple return NULL pointer and allow callers to drop this check.
>
> Given that this really is an error condition, maybe a WARN_ON_ONCE
> would fit here?

It appears some users are using defensive programming and rely simple on error
code. I dunno if they are really expect to have size == 0 in some (non-fatal)
cases.

--
With Best Regards,
Andy Shevchenko