netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: net: wireless: atmel: check memory allocation failure
@ 2017-08-22  8:11 Himanshu Jha
  2017-08-22  8:41 ` Matteo Croce
       [not found] ` <1503389481-4988-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Himanshu Jha @ 2017-08-22  8:11 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, linux-kernel, netdev, Himanshu Jha

Check memory allocation failure and return -ENOMEM if failure
occurs.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/net/wireless/atmel/at76c50x-usb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
index 09defbc..73f0924 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -940,7 +940,7 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv)
 					 GFP_KERNEL);
 
 	if (!m)
-		return;
+		return -ENOMEM;
 
 	ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m,
 			   sizeof(struct mib_mac_addr));
@@ -969,7 +969,7 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv)
 	struct mib_mac_wep *m = kmalloc(sizeof(struct mib_mac_wep), GFP_KERNEL);
 
 	if (!m)
-		return;
+		return -ENOMEM;
 
 	ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m,
 			   sizeof(struct mib_mac_wep));
@@ -1006,7 +1006,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
 					 GFP_KERNEL);
 
 	if (!m)
-		return;
+		return -ENOMEM;
 
 	ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m,
 			   sizeof(struct mib_mac_mgmt));
@@ -1043,7 +1043,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv)
 	struct mib_mac *m = kmalloc(sizeof(struct mib_mac), GFP_KERNEL);
 
 	if (!m)
-		return;
+		return -ENOMEM;
 
 	ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac));
 	if (ret < 0) {
@@ -1080,7 +1080,7 @@ static void at76_dump_mib_phy(struct at76_priv *priv)
 	struct mib_phy *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
 
 	if (!m)
-		return;
+		return -ENOMEM;
 
 	ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy));
 	if (ret < 0) {
@@ -1113,7 +1113,7 @@ static void at76_dump_mib_local(struct at76_priv *priv)
 	struct mib_local *m = kmalloc(sizeof(*m), GFP_KERNEL);
 
 	if (!m)
-		return;
+		return -ENOMEM;
 
 	ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(*m));
 	if (ret < 0) {
@@ -1138,7 +1138,7 @@ static void at76_dump_mib_mdomain(struct at76_priv *priv)
 	struct mib_mdomain *m = kmalloc(sizeof(struct mib_mdomain), GFP_KERNEL);
 
 	if (!m)
-		return;
+		return -ENOMEM;
 
 	ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m,
 			   sizeof(struct mib_mdomain));
-- 
2.7.4

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

* Re: [PATCH] drivers: net: wireless: atmel: check memory allocation failure
  2017-08-22  8:11 [PATCH] drivers: net: wireless: atmel: check memory allocation failure Himanshu Jha
@ 2017-08-22  8:41 ` Matteo Croce
       [not found] ` <1503389481-4988-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Matteo Croce @ 2017-08-22  8:41 UTC (permalink / raw)
  To: Himanshu Jha, kvalo; +Cc: linux-wireless, linux-kernel, netdev

Il giorno mar, 22/08/2017 alle 13.41 +0530, Himanshu Jha ha scritto:
> Check memory allocation failure and return -ENOMEM if failure
> occurs.
> 
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
>  drivers/net/wireless/atmel/at76c50x-usb.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c
> b/drivers/net/wireless/atmel/at76c50x-usb.c
> index 09defbc..73f0924 100644
> --- a/drivers/net/wireless/atmel/at76c50x-usb.c
> +++ b/drivers/net/wireless/atmel/at76c50x-usb.c
> @@ -940,7 +940,7 @@ static void at76_dump_mib_mac_addr(struct
> at76_priv *priv)
>  					 GFP_KERNEL);
>  
>  	if (!m)
> -		return;
> +		return -ENOMEM;
>  
>  	ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m,
>  			   sizeof(struct mib_mac_addr));
> @@ -969,7 +969,7 @@ static void at76_dump_mib_mac_wep(struct
> at76_priv *priv)
>  	struct mib_mac_wep *m = kmalloc(sizeof(struct mib_mac_wep),
> GFP_KERNEL);
>  
>  	if (!m)
> -		return;
> +		return -ENOMEM;
>  
>  	ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m,
>  			   sizeof(struct mib_mac_wep));
> @@ -1006,7 +1006,7 @@ static void at76_dump_mib_mac_mgmt(struct
> at76_priv *priv)
>  					 GFP_KERNEL);
>  
>  	if (!m)
> -		return;
> +		return -ENOMEM;
>  
>  	ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m,
>  			   sizeof(struct mib_mac_mgmt));
> @@ -1043,7 +1043,7 @@ static void at76_dump_mib_mac(struct at76_priv
> *priv)
>  	struct mib_mac *m = kmalloc(sizeof(struct mib_mac),
> GFP_KERNEL);
>  
>  	if (!m)
> -		return;
> +		return -ENOMEM;
>  
>  	ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct
> mib_mac));
>  	if (ret < 0) {
> @@ -1080,7 +1080,7 @@ static void at76_dump_mib_phy(struct at76_priv
> *priv)
>  	struct mib_phy *m = kmalloc(sizeof(struct mib_phy),
> GFP_KERNEL);
>  
>  	if (!m)
> -		return;
> +		return -ENOMEM;
>  
>  	ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct
> mib_phy));
>  	if (ret < 0) {
> @@ -1113,7 +1113,7 @@ static void at76_dump_mib_local(struct
> at76_priv *priv)
>  	struct mib_local *m = kmalloc(sizeof(*m), GFP_KERNEL);
>  
>  	if (!m)
> -		return;
> +		return -ENOMEM;
>  
>  	ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(*m));
>  	if (ret < 0) {
> @@ -1138,7 +1138,7 @@ static void at76_dump_mib_mdomain(struct
> at76_priv *priv)
>  	struct mib_mdomain *m = kmalloc(sizeof(struct mib_mdomain),
> GFP_KERNEL);
>  
>  	if (!m)
> -		return;
> +		return -ENOMEM;
>  
>  	ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m,
>  			   sizeof(struct mib_mdomain));

Perhaps these functions should return something instead of being void.

Regards,

-- 
Matteo Croce
per aspera ad upstream

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

* Re: [PATCH] drivers: net: wireless: atmel: check memory allocation failure
       [not found] ` <1503389481-4988-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-08-23  4:13   ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2017-08-23  4:13 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

Himanshu Jha <himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Check memory allocation failure and return -ENOMEM if failure
> occurs.
>
> Signed-off-by: Himanshu Jha <himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

The title prefix is wrong:

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

-- 
Kalle Valo

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

end of thread, other threads:[~2017-08-23  4:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22  8:11 [PATCH] drivers: net: wireless: atmel: check memory allocation failure Himanshu Jha
2017-08-22  8:41 ` Matteo Croce
     [not found] ` <1503389481-4988-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-23  4:13   ` 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).