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.2.0-rc1~15 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2a8b83a12300795c2f82ba19826e2eeaa5135030;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))