From a824008cc30bf9a4b99aeb00657bbe2f0be9b653 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 26 Sep 2016 13:37:50 -0400 Subject: [PATCH] Performance: special-case NULL in lttng_strlen_user_inatomic Signed-off-by: Mathieu Desnoyers --- probes/lttng-probe-user.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/probes/lttng-probe-user.c b/probes/lttng-probe-user.c index e92107d9..099a66b2 100644 --- a/probes/lttng-probe-user.c +++ b/probes/lttng-probe-user.c @@ -31,8 +31,12 @@ long lttng_strlen_user_inatomic(const char *addr) { long count = 0; - mm_segment_t old_fs = get_fs(); + mm_segment_t old_fs; + if (!addr) + return 0; + + old_fs = get_fs(); set_fs(KERNEL_DS); pagefault_disable(); for (;;) { -- 2.34.1