[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110603133726.0e55d27e@schlenkerla.am.freescale.net>
Date: Fri, 3 Jun 2011 13:37:26 -0500
From: Scott Wood <scottwood@...escale.com>
To: Alexey Dobriyan <adobriyan@...il.com>
CC: Timur Tabi <timur@...escale.com>, <alan@...rguk.ukuu.org.uk>,
<linux-kernel@...r.kernel.org>, <akpm@...ux-foundation.org>
Subject: Re: [PATCH] lib: introduce strdup_from_user
On Fri, 3 Jun 2011 21:26:21 +0300
Alexey Dobriyan <adobriyan@...il.com> wrote:
> On Fri, Jun 3, 2011 at 9:22 PM, Timur Tabi <timur@...escale.com> wrote:
> > Alexey Dobriyan wrote:
> >> NAK
> >> It accesses userspace data twice.
> >
> > What's wrong with that?
>
> If mm is shared, data can or will change under you.
>
> > How else is it supposed to know how much to allocate
> > without using strlen first?
>
> I don't know.
> What I know is that your function doesn't guarantee NUL-termination.
If the only issue is NUL-termination (and I think that's the only issue,
everything else is userspace shooting itself in the foot), just stick
"str[len] = 0" at the end.
-Scott
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists