Re: [PATCH v2 1/2] mm: fix mmap errno value when MAP_DROPPABLE is not supported

Lorenzo Stoakes (Oracle)
2026-04-07T10:06:06Z

On Thu, Apr 02, 2026 at 04:59:32PM -0700, Anthony Yznaga wrote:
> On configs where MAP_DROPPABLE is not supported (currently any 32-bit
> config except for PPC32), mmap fails with errno set to ENOTSUPP.
> However, ENOTSUPP is not a standard error value that userspace knows
> about. The acceptable userspace-visible errno to use is EOPNOTSUPP.
> checkpatch.pl has a warning to this effect.

Hmm, weird it was missed on initial patchset, but checkpatch.pl is
unfortunately overly noisy about silly things quite often so things can be
missed fairly easily.

>
> Fixes: 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Anthony Yznaga <anthony.yznaga@oracle.com>

Nice catch, LGTM, so:

Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>

> ---
> mm/mmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 5754d1c36462..2311ae7c2ff4 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -504,7 +504,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
> break;
> case MAP_DROPPABLE:
> if (VM_DROPPABLE == VM_NONE)
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> /*
> * A locked or stack area makes no sense to be droppable.
> *
> --
> 2.47.3
>

Cheers, Lorenzo