prism54: off by one BUG_ON() test
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 4 Dec 2015 13:19:49 +0000 (16:19 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 11 Dec 2015 11:22:57 +0000 (13:22 +0200)
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 <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/intersil/prism54/isl_ioctl.c

index ecbb0546cf3eed4b14f86c64a6d649d808c8eed3..48e8a978a832daf2f727d0b43bfb386ededf179d 100644 (file)
@@ -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;
 }