Re: [uml-devel] [PATCH 2/2] um: Ensure that nobody remaps the stub vma

From: Geert Uytterhoeven
Date: Tue May 06 2014 - 08:03:19 EST


Hi Richard,

On Sat, May 3, 2014 at 9:12 PM, Richard Weinberger <richard@xxxxxx> wrote:
> @@ -90,6 +91,9 @@ static int add_mmap(unsigned long virt, unsigned long phys, unsigned long len,
> struct host_vm_op *last;
> int fd, ret = 0;
>
> + if ((virt >= STUB_START) && (virt < STUB_END))
> + return -EINVAL;
> +

As you have this exact same check in three different places, I think it's worth
splitting it off in a helper function.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/