From: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> Date: Wed, 23 May 2012 10:40:25 +0100 > On Wed, 2012-05-23 at 10:02 +0200, Geert Uytterhoeven wrote: >> On Wed, May 23, 2012 at 7:46 AM, David Miller <davem@xxxxxxxxxxxxx> wrote: >> > [PATCH] sparc: Add full proper error handling to strncpy_from_user(). >> > >> > Linus removed the end-of-address-space hackery from >> > fs/namei.c:do_getname() so we really have to validate these edge >> > conditions and cannot cheat any more (as x86 used to as well). >> > >> > Move to a common C implementation like x86 did. And if both >> > src and dst are sufficiently aligned we'll do word at a time >> > copies and checks as well. >> >> Now everybody is rewriting this in plain C, perhaps it make sense to >> have it in lib/, so I don't have to write anything myself? > > I think the sparc version will work for everybody (it will certainly > work on parisc). The only thing that might be necessary is to add these > guards: > > > #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > if (((long) dst | (long) src) & (sizeof(long) - 1)) > goto byte_at_a_time; > #endif > > Dave, did you want to add it to lib/ ? Yes, but if so, the fixed version which I already pushed out to the sparc tree :-) But frankly this was only a temporary measure, I intend to put this back into assembler so I can optimize it properly, I was just too lazy to do so right now and wanted this bug fixed. -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html