From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C6B271 for ; Sun, 20 Jun 2021 08:29:11 +0000 (UTC) Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d48 with ME id KLMY2500921Fzsu03LMYf0; Sun, 20 Jun 2021 10:21:33 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 20 Jun 2021 10:21:33 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: fabioaiuto83@gmail.com, gregkh@linuxfoundation.org, ross.schm.dev@gmail.com, marcocesati@gmail.com, insafonov@gmail.com, hdegoede@redhat.com Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] staging: rtl8723bs: Fix an error handling path Date: Sun, 20 Jun 2021 10:21:31 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 'ret' is known to be 0 at this point. It must be set to -ENOMEM if a memory allocation occurs. Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver") Signed-off-by: Christophe JAILLET --- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 149d3b6e44d0..692d69de20cb 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -420,8 +420,10 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); pwep = kzalloc(wep_total_len, GFP_KERNEL); - if (!pwep) + if (!pwep) { + ret = -ENOMEM; goto exit; + } pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len; -- 2.30.2