[PATCH] lttng: Fix recent modifications to string_from_user operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yannick Brosseau <yannick.brosseau@xxxxxxxxx>

Include: a fix for a recently introduced change: obviously max_t should
be used instead of min_t here. Also, a likely should apply to the result
of the comparison, not the variable per se.

Signed-off-by: Yannick Brosseau <yannick.brosseau@xxxxxxxxx>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
---
diff --git a/drivers/staging/lttng/probes/lttng-events.h b/drivers/staging/lttng/probes/lttng-events.h
index 16eee9a..cca346c 100644
--- a/drivers/staging/lttng/probes/lttng-events.h
+++ b/drivers/staging/lttng/probes/lttng-events.h
@@ -346,7 +346,7 @@ static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
 #undef __string_from_user
 #define __string_from_user(_item, _src)					       \
 	__event_len += __dynamic_len[__dynamic_len_idx++] =		       \
-		min_t(size_t, strlen_user(_src), 1);
+		max_t(size_t, strlen_user(_src), 1);
 
 #undef TP_PROTO
 #define TP_PROTO(args...) args
@@ -556,7 +556,7 @@ __assign_##dest##_2:							\
 			(void) __typemap.dest;				\
 		lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__typemap.dest));\
 		__ustrlen = __get_dynamic_array_len(dest);		\
-		if (likely(__ustrlen) > 1) {				\
+		if (likely(__ustrlen > 1)) {				\
 			__chan->ops->event_write_from_user(&__ctx, src,	\
 				__ustrlen - 1);				\
 		}							\

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux