* [PATCH] staging: rtl8723bs: os_dep: ioctl_linux: Make use rtw_zmalloc
@ 2019-06-16 5:32 Hariprasad Kelam
2019-06-16 7:15 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Hariprasad Kelam @ 2019-06-16 5:32 UTC (permalink / raw)
To: Greg Kroah-Hartman, Michael Straube, Hariprasad Kelam,
Mamta Shukla, Shobhit Kukreti, Emanuel Bennici, Puranjay Mohan,
devel, linux-kernel
rtw_malloc with memset can be replace with rtw_zmalloc.
Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index fc3885d..c59e366 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -478,14 +478,12 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
if (wep_key_len > 0) {
wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
- pwep = rtw_malloc(wep_total_len);
+ pwep = rtw_zmalloc(wep_total_len);
if (pwep == NULL) {
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, (" wpa_set_encryption: pwep allocate fail !!!\n"));
goto exit;
}
- memset(pwep, 0, wep_total_len);
-
pwep->KeyLength = wep_key_len;
pwep->Length = wep_total_len;
@@ -2144,12 +2142,10 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
int ret = 0;
param_len = sizeof(struct ieee_param) + pext->key_len;
- param = rtw_malloc(param_len);
+ param = rtw_zmalloc(param_len);
if (param == NULL)
return -1;
- memset(param, 0, param_len);
-
param->cmd = IEEE_CMD_SET_ENCRYPTION;
memset(param->sta_addr, 0xff, ETH_ALEN);
@@ -3521,14 +3517,12 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
if (wep_key_len > 0) {
wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
- pwep = rtw_malloc(wep_total_len);
+ pwep = rtw_zmalloc(wep_total_len);
if (pwep == NULL) {
DBG_871X(" r871x_set_encryption: pwep allocate fail !!!\n");
goto exit;
}
- memset(pwep, 0, wep_total_len);
-
pwep->KeyLength = wep_key_len;
pwep->Length = wep_total_len;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8723bs: os_dep: ioctl_linux: Make use rtw_zmalloc
2019-06-16 5:32 [PATCH] staging: rtl8723bs: os_dep: ioctl_linux: Make use rtw_zmalloc Hariprasad Kelam
@ 2019-06-16 7:15 ` Dan Carpenter
2019-06-18 1:28 ` Hariprasad Kelam
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2019-06-16 7:15 UTC (permalink / raw)
To: Hariprasad Kelam
Cc: Greg Kroah-Hartman, Michael Straube, Mamta Shukla,
Shobhit Kukreti, Emanuel Bennici, Puranjay Mohan, devel,
linux-kernel
On Sun, Jun 16, 2019 at 11:02:50AM +0530, Hariprasad Kelam wrote:
> rtw_malloc with memset can be replace with rtw_zmalloc.
>
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
> drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index fc3885d..c59e366 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -478,14 +478,12 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
> if (wep_key_len > 0) {
> wep_key_len = wep_key_len <= 5 ? 5 : 13;
> wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
> - pwep = rtw_malloc(wep_total_len);
> + pwep = rtw_zmalloc(wep_total_len);
We should not introduce new uses of rtw_malloc() or rtw_zmalloc(). They
are buggy garbage. Use normall kmalloc() and kzalloc().
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8723bs: os_dep: ioctl_linux: Make use rtw_zmalloc
2019-06-16 7:15 ` Dan Carpenter
@ 2019-06-18 1:28 ` Hariprasad Kelam
0 siblings, 0 replies; 3+ messages in thread
From: Hariprasad Kelam @ 2019-06-18 1:28 UTC (permalink / raw)
To: Dan Carpenter, Greg Kroah-Hartman, Michael Straube,
Nishka Dasgupta, Mamta Shukla, Emanuel Bennici, Shobhit Kukreti,
Puranjay Mohan, devel, linux-kernel
On Sun, Jun 16, 2019 at 10:15:22AM +0300, Dan Carpenter wrote:
> On Sun, Jun 16, 2019 at 11:02:50AM +0530, Hariprasad Kelam wrote:
> > rtw_malloc with memset can be replace with rtw_zmalloc.
> >
> > Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> > ---
> > drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 12 +++---------
> > 1 file changed, 3 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > index fc3885d..c59e366 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > @@ -478,14 +478,12 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
> > if (wep_key_len > 0) {
> > wep_key_len = wep_key_len <= 5 ? 5 : 13;
> > wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
> > - pwep = rtw_malloc(wep_total_len);
> > + pwep = rtw_zmalloc(wep_total_len);
>
> We should not introduce new uses of rtw_malloc() or rtw_zmalloc(). They
> are buggy garbage. Use normall kmalloc() and kzalloc().
Hi Dan Carpenter,
Sure , will resend this patch with suggested changes.
Thanks,
Hariprasad k
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-18 1:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-16 5:32 [PATCH] staging: rtl8723bs: os_dep: ioctl_linux: Make use rtw_zmalloc Hariprasad Kelam
2019-06-16 7:15 ` Dan Carpenter
2019-06-18 1:28 ` Hariprasad Kelam
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.