Skip to contentSkip to conversation

staging: use structure pointer to get the size of the structure

PATCH Superseded Santha Meena Ramamoorthy 3 participants 5 messages Feb 24, 2018 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: use structure pointer to get the size of the structure

Use pointer to the structure to get the size of the structure. Issue found using checkpatch.

---
Change in v2:
- Use single line when the number of characters is less than 80

 drivers/staging/rtl8192e/rtllib_wx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8192e/rtllib_wx.c +1 -2
index 03fbff0..74d4d2d 100644
@@ -371,8 +371,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 		struct lib80211_crypt_data *new_crypt;
 
 		/* take WEP into use */
-		new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
-				    GFP_KERNEL);
+		new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
 		if (new_crypt == NULL)
 			return -ENOMEM;
 		new_crypt->ops = lib80211_get_crypto_ops("R-WEP");
Signature · 1 line
2.7.4
#1 lore raw

Hello,

I have recently found out about this project and would like to make some contributions.

May I know what is the first contribution that I can start with?

Thank you,
Haley Shah.

Quoted 39 lines · Santha Meena Ramamoorthy

Use pointer to the structure to get the size of the structure. Issue found using checkpatch.

---
Change in v2:
- Use single line when the number of characters is less than 80

 drivers/staging/rtl8192e/rtllib_wx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8192e/rtllib_wx.c +1 -3
index 03fbff0..74d4d2d 100644
@@ -371,8 +371,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
                struct lib80211_crypt_data *new_crypt;
 
                /* take WEP into use */
-               new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
-                                   GFP_KERNEL);
+               new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
                if (new_crypt == NULL)
                        return -ENOMEM;
                new_crypt->ops = lib80211_get_crypto_ops("R-WEP");
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/
msgid/outreachy-kernel/1519505516-10389-1-git-send- email-santhameena13%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 5 lines · Hetavi (Haley) Shah

Hello,
I have recently found out about this project and would like to make some contributions.

May I know what is the first contribution that I can start with?

Please start by reading and working through the tutorial that is linked to in the outreachy page: https://kernelnewbies.org/Outreachyfirstpatch

Also, please don't respond to random mails with questions about other topics. It is particularly confusing to see a mail that has a PATCH subject line and is not a patch.

julia

#3 lore raw
In reply to Santha Meena Ramamoorthy

Sorry for not noticing this before, but the subject line needs to be more specific than staging. Use git log --oneline on the file to see what others have done before.

Quoted 1 line · Santha Meena Ramamoorthy

Use pointer to the structure to get the size of the structure.

It would also be good to say why this is a good idea. The code remains correct even if the type changes.

Also, it looks liek you have not followed the get_maintainer call suggested in the tutorial. Greg is the only maintainer listed on this code.

julia

Quoted 34 lines

Issue
found using checkpatch.

---
Change in v2:
- Use single line when the number of characters is less than 80

 drivers/staging/rtl8192e/rtllib_wx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8192e/rtllib_wx.c +1 -3
index 03fbff0..74d4d2d 100644
@@ -371,8 +371,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 		struct lib80211_crypt_data *new_crypt;
 
 		/* take WEP into use */
-		new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
-				    GFP_KERNEL);
+		new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
 		if (new_crypt == NULL)
 			return -ENOMEM;
 		new_crypt->ops = lib80211_get_crypto_ops("R-WEP");
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1519505516-10389-1-git-send-email-santhameena13%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw
Quoted 8 lines · Julia Lawall

Sorry for not noticing this before, but the subject line needs to be more specific than staging. Use git log --oneline on the file to see what others have done before.

Quoted 1 line · Santha Meena Ramamoorthy

Use pointer to the structure to get the size of the structure.

Quoted 8 lines

It would also be good to say why this is a good idea. The code remains correct even if the type changes.

Also, it looks liek you have not followed the get_maintainer call suggested in the tutorial. Greg is the only maintainer listed on this code.

julia

Sorry, I'll fix them now.

Thanks,
Santha

Quoted 35 lines
Quoted 35 lines

Issue
found using checkpatch.

---
Change in v2:
- Use single line when the number of characters is less than 80

 drivers/staging/rtl8192e/rtllib_wx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8192e/rtllib_wx.c +1 -3
index 03fbff0..74d4d2d 100644
@@ -371,8 +371,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 		struct lib80211_crypt_data *new_crypt;
 
 		/* take WEP into use */
-		new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
-				    GFP_KERNEL);
+		new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
 		if (new_crypt == NULL)
 			return -ENOMEM;
 		new_crypt->ops = lib80211_get_crypto_ops("R-WEP");
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1519505516-10389-1-git-send-email-santhameena13%40gmail.com.
For more options, visit https://groups.google.com/d/optout.