From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B40D4C433EF for ; Mon, 20 Jun 2022 13:21:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241448AbiFTNV1 (ORCPT ); Mon, 20 Jun 2022 09:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242548AbiFTNUa (ORCPT ); Mon, 20 Jun 2022 09:20:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 856651B7B0; Mon, 20 Jun 2022 06:08:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 493AA61546; Mon, 20 Jun 2022 13:06:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A54EC3411C; Mon, 20 Jun 2022 13:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730411; bh=IZenuG6VcAy/vwb5NTPWmJ0UMfDIybVEzJVA13pGHcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q+calw3JlOjTrLYyKwP0xBrxPFrcAfRzJt4KIuv4DzK6/2bXU5bDQiTwaQkS9vc/P Nqh+5xtWZSuARlZJr/P6Y/gopKMBeVmrgQr/glh7HLNJxIQlaS7BUe1Qjg4/b3oS1w ZUhW/uCmkoyVR41myuoYUjqihqJnUYPuO8vtpQOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Sasha Levin Subject: [PATCH 5.15 045/106] staging: r8188eu: Use zeroing allocator in wpa_set_encryption() Date: Mon, 20 Jun 2022 14:51:04 +0200 Message-Id: <20220620124725.721015507@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124724.380838401@linuxfoundation.org> References: <20220620124724.380838401@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gustavo A. R. Silva [ 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 Link: https://lore.kernel.org/r/20211012024624.GA1062447@embeddedor Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +-- 1 file changed, 1 insertion(+), 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) { -- 2.35.1