[lttng-dev] [PATCH lttng-modules] Fix check in lttng_strlen_user_inatomic

Simon Marchi simon.marchi at polymtl.ca
Wed Feb 6 09:54:34 EST 2013


__copy_from_user_inatomic returns the number of bytes that could not be
copied, not an error code. This fixes the test accordingly.

Signed-off-by: Simon Marchi <simon.marchi at polymtl.ca>
---
 probes/lttng-probe-user.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/probes/lttng-probe-user.c b/probes/lttng-probe-user.c
index 94ecf2f..a2368b5 100644
--- a/probes/lttng-probe-user.c
+++ b/probes/lttng-probe-user.c
@@ -41,7 +41,7 @@ long lttng_strlen_user_inatomic(const char *addr)
 		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))
-- 
1.7.1




More information about the lttng-dev mailing list