mirror of
https://github.com/torvalds/linux.git
synced 2026-05-21 21:37:25 +02:00
staging: r8188eu: Use zeroing allocator in wpa_set_encryption()
Use zeroing allocator rather than allocator followed by memset with 0. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20211012024624.GA1062447@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
05d744fc28
commit
c82462f124
|
|
@ -419,11 +419,10 @@ 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 = kmalloc(wep_total_len, GFP_KERNEL);
|
||||
pwep = kzalloc(wep_total_len, GFP_KERNEL);
|
||||
if (!pwep)
|
||||
goto exit;
|
||||
|
||||
memset(pwep, 0, wep_total_len);
|
||||
pwep->KeyLength = wep_key_len;
|
||||
pwep->Length = wep_total_len;
|
||||
if (wep_key_len == 13) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user