From: Frederik Deweerdt <deweerdt@free.fr>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Arjan van de Ven <arjan@infradead.org>,
Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@zip.com.au>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Ulrich Drepper <drepper@redhat.com>,
Zach Brown <zach.brown@oracle.com>,
Evgeniy Polyakov <johnpol@2ka.mipt.ru>,
"David S. Miller" <davem@davemloft.net>,
Suparna Bhattacharya <suparna@in.ibm.com>,
Davide Libenzi <davidel@xmailserver.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [patch 05/14] syslets: core code
Date: Fri, 16 Feb 2007 18:28:13 +0000 [thread overview]
Message-ID: <20070216182813.GB32060@slug> (raw)
In-Reply-To: <20070215165228.GF4285@elte.hu>
On Thu, Feb 15, 2007 at 05:52:28PM +0100, Ingo Molnar wrote:
> From: Ingo Molnar <mingo@elte.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
next prev parent reply other threads:[~2007-02-15 18:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-15 16:52 [patch 05/14] syslets: core code Ingo Molnar
2007-02-15 17:46 ` Zach Brown
2007-02-16 18:28 ` Frederik Deweerdt [this message]
2007-02-17 0:52 ` Davide Libenzi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070216182813.GB32060@slug \
--to=deweerdt@free.fr \
--cc=akpm@zip.com.au \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjan@infradead.org \
--cc=davem@davemloft.net \
--cc=davidel@xmailserver.org \
--cc=drepper@redhat.com \
--cc=hch@infradead.org \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=suparna@in.ibm.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=zach.brown@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox