From: Pavel Machek <pavel@ucw.cz>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: linux-arch@vger.kernel.org, torvalds@linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/19] untangling do_mremap(), part 1
Date: Sat, 12 Dec 2009 20:31:35 +0100 [thread overview]
Message-ID: <20091212193134.GD1308@ucw.cz> (raw)
In-Reply-To: <E1NHUdk-0007ul-Oc@ZenIV.linux.org.uk>
Hi!
> Take locating vma and checks on it to a separate helper (it will be
> shared between MREMAP_FIXED/non-MREMAP_FIXED cases when we split
> them in the next patch)
> +static struct vm_area_struct *vma_to_resize(unsigned long addr,
> + unsigned long old_len, unsigned long new_len, unsigned long *p)
> +{
> + struct mm_struct *mm = current->mm;
> + struct vm_area_struct *vma = find_vma(mm, addr);
> +
> + if (!vma || vma->vm_start > addr)
> + goto Efault;
> +
> + if (is_vm_hugetlb_page(vma))
> + goto Einval;
> +
> + /* We can't remap across vm area boundaries */
> + if (old_len > vma->vm_end - addr)
> + goto Efault;
...
> +Efault: /* very odd choice for most of the cases, but... */
> + return ERR_PTR(-EFAULT);
> +Einval:
> + return ERR_PTR(-EINVAL);
> +Enomem:
> + return ERR_PTR(-ENOMEM);
> +Eagain:
> + return ERR_PTR(-EAGAIN);
> +}
Could we just do returns directly, w/o the gotos? In this case I do
not think goto has advantages, as there's no cleanup to do...
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2009-12-12 19:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-07 3:52 [PATCH 1/19] untangling do_mremap(), part 1 Al Viro
2009-12-07 17:17 ` Linus Torvalds
2009-12-07 18:44 ` Al Viro
2009-12-07 19:35 ` Linus Torvalds
2009-12-07 19:43 ` Al Viro
2009-12-12 19:31 ` Pavel Machek [this message]
2009-12-12 19:31 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091212193134.GD1308@ucw.cz \
--to=pavel@ucw.cz \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).