Re: [PATCH 2/3] extend get/setrlimit to support setting rlimitsexternal to a process (v7)

From: Neil Horman
Date: Mon Nov 02 2009 - 12:40:45 EST


On Mon, Nov 02, 2009 at 04:10:32PM +0100, Ingo Molnar wrote:
>
> two small comments:
>
> this is a really dangerous pattern:
>
> > + if (!lock_task_sighand(tsk, &flags))
> > + goto out_put_all;
> > +
>
> as it's followed by:
>
> > + else {
> > + struct rlimit val;
> > +
> > + task_lock(tsk->group_leader);
> > + val = current->signal->rlim[resource];
> > + task_unlock(tsk->group_leader);
> > + retval = copy_to_user(rlim, &val, sizeof(*rlim)) ? -EFAULT : 0;
> > + }
>
> please turn that into the regular:
>
> if () {
> ...
> } else {
> ...
> }
>
> pattern that is a lot harder to mess up later on.
>
Yeah, ok, I can do that.

> > + return retval;
> > +}
> > +
> > +
> > #ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
>
> one too many newlines?
>
Probably, I'll trim it. Thanks.
Neil

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