From: Dan Carpenter Date: Fri, 4 Dec 2015 13:19:49 +0000 (+0300) Subject: prism54: off by one BUG_ON() test X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bd9a212bab3db65baff094fe811ef1b593faca2a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git prism54: off by one BUG_ON() test This code was supposed to trigger a BUG() if we truncate the output but it's off by one so it allows one character to be truncated. Really drivers shouldn't call BUG_ON() and especially for something minor like this so I've changed it to a WARN_ON(). Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/intersil/prism54/isl_ioctl.c b/drivers/net/wireless/intersil/prism54/isl_ioctl.c index ecbb0546cf3e..48e8a978a832 100644 --- a/drivers/net/wireless/intersil/prism54/isl_ioctl.c +++ b/drivers/net/wireless/intersil/prism54/isl_ioctl.c @@ -2036,7 +2036,7 @@ format_event(islpci_private *priv, char *dest, const char *str, mlme->address, (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ") : ""), mlme->code); - BUG_ON(n > IW_CUSTOM_MAX); + WARN_ON(n >= IW_CUSTOM_MAX); *length = n; }