From 66eaaf4d0dee6fefb8b1b9a67e3228be4ec41052 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 27 Oct 2015 22:15:31 +0700 Subject: [PATCH] staging: rtl8188eu: clamp kernel macro used in proc_get_rx_signal To limit the range of integers there is clamp macro. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_debug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_debug.c b/drivers/staging/rtl8188eu/core/rtw_debug.c index 993c7db87a1a..2c4afb80fc64 100644 --- a/drivers/staging/rtl8188eu/core/rtw_debug.c +++ b/drivers/staging/rtl8188eu/core/rtw_debug.c @@ -594,8 +594,7 @@ int proc_set_rx_signal(struct file *file, const char __user *buffer, if (is_signal_dbg && num != 2) return count; - signal_strength = signal_strength > 100 ? 100 : signal_strength; - signal_strength = signal_strength < 0 ? 0 : signal_strength; + signal_strength = clamp(signal_strength, 0, 100); padapter->recvpriv.is_signal_dbg = is_signal_dbg; padapter->recvpriv.signal_strength_dbg = signal_strength; -- 2.20.1