Re: [PATCH] Many groups patch.

From: Linus Torvalds
Date: Wed Oct 01 2003 - 14:25:25 EST



On Wed, 1 Oct 2003, Tim Hockin wrote:
>
> This patch touches all the compat code in the 64-bit architectures.
> These files have a LOT of duplicated code from uid16.c. I did not try to
> reduce duplicated code, and instead followed suit.

Augh. It also makes code even uglier than it used to be:

...

+ u16 group;
+ if (copy_from_user(&group, grouplist+i, sizeof(group)))
+ return -EFAULT;

which is really a memcpy() of two bytes at a time. That's disgusting. It
really should be

u16 group;

if (nr > TASK_SIZE / sizeof(group))
return -EFAULT;
if (!access_ok(grouplist, nr*sizeof(group))
return -EFAULT;
...

if (__get_user(group, grouplist + i))
return -EFAULT;
...

which really is so common that it _really_ should be in kernel/uid16.c
(or, actually create a new kernel/gid16.c file) rather than copied
(incorrectly) to a lot of architectures. Then things like the above can be
done right once, rather than merging this that does the nasty thing over
and over.

Sorry to just complain all the time,

Linus

-
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/