From: Simon Marchi Date: Wed, 6 Feb 2013 16:26:59 +0000 (-0500) Subject: Fix check in lttng_strlen_user_inatomic X-Git-Tag: v2.1.1~3 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c1ee10d076b0fd69b649bcd9a5f4f8de77dc9294;p=lttng-modules.git Fix check in lttng_strlen_user_inatomic __copy_from_user_inatomic returns the number of bytes that could not be copied, not an error code. This fixes the test accordingly. [ Edit by Mathieu Desnoyers: change "ret" type to unsigned long too. ] Signed-off-by: Simon Marchi Signed-off-by: Mathieu Desnoyers --- diff --git a/probes/lttng-probe-user.c b/probes/lttng-probe-user.c index 94ecf2f1..d0b5cf29 100644 --- a/probes/lttng-probe-user.c +++ b/probes/lttng-probe-user.c @@ -36,12 +36,12 @@ long lttng_strlen_user_inatomic(const char *addr) pagefault_disable(); for (;;) { char v; - long ret; + unsigned long ret; ret = __copy_from_user_inatomic(&v, (__force const char __user *)(addr), sizeof(v)); - if (unlikely(ret == -EFAULT)) + if (unlikely(ret > 0)) break; count++; if (unlikely(!v))