kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] prism54: off by one BUG_ON() test
@ 2015-12-04 13:19 Dan Carpenter
  2015-12-11 11:23 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-12-04 13:19 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: Kalle Valo, linux-wireless, kernel-janitors

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>

diff --git a/drivers/net/wireless/intersil/prism54/isl_ioctl.c b/drivers/net/wireless/intersil/prism54/isl_ioctl.c
index ecbb054..48e8a97 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;
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: prism54: off by one BUG_ON() test
  2015-12-04 13:19 [patch] prism54: off by one BUG_ON() test Dan Carpenter
@ 2015-12-11 11:23 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2015-12-11 11:23 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Luis R. Rodriguez, linux-wireless, kernel-janitors


> 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>

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

Kalle Valo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-11 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-04 13:19 [patch] prism54: off by one BUG_ON() test Dan Carpenter
2015-12-11 11:23 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).