diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2021-10-11 21:46:24 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-22 14:21:59 +0200 |
commit | 2595e803130bcd6ecda6451282916c7568c166b2 (patch) | |
tree | 6e833e8c9fd40226b5a5fa3b7fca3071c856041d /drivers/staging | |
parent | d56bc9e8760ac1b0366678c97d1e92ac4fec79c4 (diff) |
staging: r8188eu: Use zeroing allocator in wpa_set_encryption()
[ Upstream commit c82462f124df06a0a34793f1a1dafe5c146a2a6f ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index fbfce4481ffe..3e9325d89afc 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -466,11 +466,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) { |