[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca081371-7b21-85d2-edcc-8b7273c09cb2@oracle.com>
Date: Fri, 15 Jun 2018 10:43:03 -0400
From: Boris Ostrovsky <boris.ostrovsky@...cle.com>
To: Juergen Gross <jgross@...e.com>, linux-kernel@...r.kernel.org,
xen-devel@...ts.xenproject.org
Subject: Re: [PATCH] xen: add new hypercall buffer mapping device
On 06/15/2018 09:17 AM, Juergen Gross wrote:
> +static int privcmd_buf_mmap(struct file *file, struct vm_area_struct *vma)
> +{
> + struct privcmd_buf_private *file_priv = file->private_data;
> + struct privcmd_buf_vma_private *vma_priv;
> + unsigned int count = vma_pages(vma);
> + unsigned int i;
> + int ret = 0;
> +
> + if (!(vma->vm_flags & VM_SHARED)) {
> + pr_err("Mapping must be shared\n");
> + return -EINVAL;
> + }
> +
> + if (file_priv->allocated + count > limit) {
> + pr_err("Mapping limit reached!\n");
> + return -ENOSPC;
This error (which I thought should have been E2BIG) is not in the list
of allowed error codes (per man page). I think it it's either EINVAL or
ENOMEM (EINVAL seems more appropriate to me).
I am also not sure about pr_err as the caller can force it (although
presumably the file is only accessible to superuser).
-boris
Powered by blists - more mailing lists