All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] orinoco: avoid assertion in case of NULL pointer
@ 2019-12-15 19:58 Aditya Pakki
  2019-12-16  9:50 ` Markus Elfring
  2019-12-18 19:09 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2019-12-15 19:58 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Kalle Valo, David S. Miller, linux-wireless, netdev, linux-kernel

In ezusb_init, if upriv is NULL, the code crashes. However, the caller
in ezusb_probe can handle the error and print the failure message.
The patch replaces the BUG_ON call to error return.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
index 40a8b941ad5c..813de06c03de 100644
--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
+++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
@@ -1361,7 +1361,8 @@ static int ezusb_init(struct hermes *hw)
 	int retval;
 
 	BUG_ON(in_interrupt());
-	BUG_ON(!upriv);
+	if (!upriv)
+		return -EINVAL;
 
 	upriv->reply_count = 0;
 	/* Write the MAGIC number on the simulated registers to keep
-- 
2.20.1


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

* Re: [PATCH] orinoco: avoid assertion in case of NULL pointer
  2019-12-15 19:58 [PATCH] orinoco: avoid assertion in case of NULL pointer Aditya Pakki
@ 2019-12-16  9:50 ` Markus Elfring
  2019-12-18 19:09 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-12-16  9:50 UTC (permalink / raw)
  To: Aditya Pakki, linux-wireless, netdev
  Cc: linux-kernel, David S. Miller, Kalle Valo, Kangjie Lu

> The patch replaces the BUG_ON call to error return.

Would a wording like “Replace the BUG_ON() call by a return of an error code
after a null pointer check” be nicer for this change description?

Will the tag “Fixes” become helpful here?

Regards,
Markus

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

* Re: [PATCH] orinoco: avoid assertion in case of NULL pointer
  2019-12-15 19:58 [PATCH] orinoco: avoid assertion in case of NULL pointer Aditya Pakki
  2019-12-16  9:50 ` Markus Elfring
@ 2019-12-18 19:09 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-12-18 19:09 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: pakki001, kjlu, David S. Miller, linux-wireless, netdev, linux-kernel

Aditya Pakki <pakki001@umn.edu> wrote:

> In ezusb_init, if upriv is NULL, the code crashes. However, the caller
> in ezusb_probe can handle the error and print the failure message.
> The patch replaces the BUG_ON call to error return.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

Patch applied to wireless-drivers-next.git, thanks.

c705f9fc6a17 orinoco: avoid assertion in case of NULL pointer

-- 
https://patchwork.kernel.org/patch/11293143/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2019-12-18 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 19:58 [PATCH] orinoco: avoid assertion in case of NULL pointer Aditya Pakki
2019-12-16  9:50 ` Markus Elfring
2019-12-18 19:09 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.