Skip to contentSkip to conversation

prism54: off by one BUG_ON() test

PATCH Applied Dan Carpenter 2 participants 2 messages Dec 4, 2015 – Dec 11, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().

drivers/net/wireless/intersil/prism54/isl_ioctl.c +1 -1
index ecbb054..48e8a97 100644
@@ -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;
 }
 
Applied
#1 lore raw
Quoted 7 lines

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().

Thanks, applied to wireless-drivers-next.git.

Kalle Valo