All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: r8188eu: fix memory leak in rtw_set_key
@ 2021-09-03 18:17 Pavel Skripkin
  2021-09-03 18:18 ` [PATCH 2/2] staging: r8188eu: remove useless memset Pavel Skripkin
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Skripkin @ 2021-09-03 18:17 UTC (permalink / raw)
  To: Larry.Finger, phil, gregkh, straube.linux, fmdefrancesco
  Cc: linux-kernel, linux-staging, Pavel Skripkin

Before returning with an error we should free allocated buffers, since
they are not assigned to anywhere.

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_mlme.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index 1115ff5d865a..bd991d7ed809 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -1722,6 +1722,8 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in
 		psetkeyparm->grpkey = 1;
 		break;
 	default:
+		kfree(psetkeyparm);
+		kfree(pcmd);
 		res = _FAIL;
 		goto exit;
 	}
-- 
2.33.0


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

* [PATCH 2/2] staging: r8188eu: remove useless memset
  2021-09-03 18:17 [PATCH 1/2] staging: r8188eu: fix memory leak in rtw_set_key Pavel Skripkin
@ 2021-09-03 18:18 ` Pavel Skripkin
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Skripkin @ 2021-09-03 18:18 UTC (permalink / raw)
  To: Larry.Finger, phil, gregkh, straube.linux, fmdefrancesco
  Cc: linux-kernel, linux-staging, Pavel Skripkin

psetkeyparm is kzalloced buffer, there is no need in zeroing it one more
time, since kzalloc had already set memory to 0.

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_mlme.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index bd991d7ed809..37578638bb76 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -1690,8 +1690,6 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in
 		goto exit;
 	}
 
-	memset(psetkeyparm, 0, sizeof(struct setkey_parm));
-
 	if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)
 		psetkeyparm->algorithm = (unsigned char)psecuritypriv->dot118021XGrpPrivacy;
 	else
-- 
2.33.0


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

end of thread, other threads:[~2021-09-03 18:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03 18:17 [PATCH 1/2] staging: r8188eu: fix memory leak in rtw_set_key Pavel Skripkin
2021-09-03 18:18 ` [PATCH 2/2] staging: r8188eu: remove useless memset Pavel Skripkin

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.