[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070216182813.GB32060@slug>
Date: Fri, 16 Feb 2007 18:28:13 +0000
From: Frederik Deweerdt <deweerdt@...e.fr>
To: Ingo Molnar <mingo@...e.hu>
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Arjan van de Ven <arjan@...radead.org>,
Christoph Hellwig <hch@...radead.org>,
Andrew Morton <akpm@....com.au>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Ulrich Drepper <drepper@...hat.com>,
Zach Brown <zach.brown@...cle.com>,
Evgeniy Polyakov <johnpol@....mipt.ru>,
"David S. Miller" <davem@...emloft.net>,
Suparna Bhattacharya <suparna@...ibm.com>,
Davide Libenzi <davidel@...ilserver.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [patch 05/14] syslets: core code
On Thu, Feb 15, 2007 at 05:52:28PM +0100, Ingo Molnar wrote:
> From: Ingo Molnar <mingo@...e.hu>
> +static struct syslet_uatom __user *
> +exec_atom(struct async_head *ah, struct task_struct *t,
> + struct syslet_uatom __user *uatom)
> +{
> + struct syslet_uatom __user *last_uatom;
> + struct syslet_atom atom;
> + long ret;
> +
- run_next:
+ do {
> + if (unlikely(copy_uatom(&atom, uatom)))
> + return ERR_PTR(-EFAULT);
> +
> + last_uatom = uatom;
> + ret = __exec_atom(t, &atom);
> + if (unlikely(signal_pending(t) || need_resched()))
+ break;
- goto stop;
> +
> + uatom = next_uatom(&atom, uatom, ret);
+ } while(uatom);
- if (uatom)
- goto run_next;
- stop:
> + /*
> + * We do completion only in async context:
> + */
> + if (t->at && complete_uatom(ah, t, &atom, last_uatom))
> + return ERR_PTR(-EFAULT);
> +
> + return last_uatom;
> +}
Goto's are cool granted :), but IMO the "do {} while()" is more natural
here.
> +asmlinkage long
> +sys_async_register(struct async_head_user __user *ahu, unsigned int len)
> +{
> + struct task_struct *t = current;
> +
> + /*
> + * This 'len' check enables future extension of
> + * the async_head ABI:
> + */
I'm not sure I understand why this isn't a '>' check. If you want to
extend the ABI, you'll add members to async_head_user. So you just need
to check that you understand all the information that userspace passes
to you, or did I missed something?
> + if (len != sizeof(struct async_head_user))
> + return -EINVAL;
> + /*
> + * Already registered?
> + */
> + if (t->ah)
> + return -EEXIST;
> +
> + return async_head_init(t, ahu);
> +}
> +
Regards,
Frederik
-
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