Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1161821pxb; Fri, 1 Apr 2022 06:19:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEmAcXVDSPFpnQynDvzn0+3WR6W66o2x4IeusfoUPLbQC+FXtwdtywMVRxbhzRhvEAIZLf X-Received: by 2002:a17:907:3e25:b0:6e1:40ec:29d7 with SMTP id hp37-20020a1709073e2500b006e140ec29d7mr9353356ejc.119.1648819159701; Fri, 01 Apr 2022 06:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648819159; cv=none; d=google.com; s=arc-20160816; b=yH53K7QcQlXQY0Z99zeh4WUjyVYQuxNkKAj9pVSie9qM6ga9vt5GcOYLjW/boX22vV cStvjfPEncysYSHKx98woGQWGtGGA1zkFB1DiBX1VuVyl71POwMiLrlBvH143p3SQavB +7SjXpGN6wr7uRbT6fB3EG1QE/YLiClCJkAUoIiffn0R5Y4uR2FXiQ5obog96unluluX z/z7lyR6Ryn5q/kNl5B8fohUoilcuTYZaNk5bzh4QqFgVTyvVm/xOApnk0NssuG/zF2l n10bdGgRpyQSjNQQCteY0ct58EraEnZSW+3nUtEr3mWm97PkMUsX7DZw/sMFJuoDsvtL M8Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:cc:to:from:message-id :dkim-signature; bh=ctWsvOCYw/Nk+/HVUYkGj4y3NFwJ5+znyibIFc9hryU=; b=0brkc3OOSzDA6q7oCangHJDi3cBm0ExYwwQrSP/sZuJL/gxDrxAUsRpxPqRKLpgm2p UGZweEKUXl1l+w5+038wyQEKtlh+Dmxl0wgXJiD9hK/A5Y5K61MnE6SKI9koATXAntXM QUwyPfMt06fn13uT/Cb7zCVCmnA1ODrnNWSzbfnUcfnpmIQHYxNqUNnZ8I5fRHaNUfMz qvBJ0JOqU+bK+BNZDxcPLHHA1BUsqzT9Q8BkMAM1aKd0QVhVB/T57jbxMdkIag155vdz fPIzNHHv/Cq4XNaDHkLOg9t0nYjgi8EuTAZiYsP7XAHWlgfA8TYHCWk+sIefn+ReXFqn K5lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=ix3cbYpJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qo23-20020a170907213700b006df76385d7asi1487525ejb.538.2022.04.01.06.18.53; Fri, 01 Apr 2022 06:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=ix3cbYpJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240485AbiCaRJ4 (ORCPT + 99 others); Thu, 31 Mar 2022 13:09:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234189AbiCaRJz (ORCPT ); Thu, 31 Mar 2022 13:09:55 -0400 Received: from out203-205-251-82.mail.qq.com (out203-205-251-82.mail.qq.com [203.205.251.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED9491F0824 for ; Thu, 31 Mar 2022 10:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1648746486; bh=ctWsvOCYw/Nk+/HVUYkGj4y3NFwJ5+znyibIFc9hryU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ix3cbYpJq7wD4bQn1V9sM79AQk5EAlSEvzgiK18muoULTWuF8NhD/4U6S1sCzPHly 13ivebdXLoebBYvoU3EyVe6jLaVGWyCofRV4GVT8gstyIOFQ7iEdCFDEIx/eaNCJ6x Xu1kPDDBFzgqgg3xX9AagbBvt9s+mQMx/b8EomLg= Received: from localhost.localdomain ([218.197.153.188]) by newxmesmtplogicsvrszc6.qq.com (NewEsmtp) with SMTP id 2031D0A9; Fri, 01 Apr 2022 01:08:03 +0800 X-QQ-mid: xmsmtpt1648746483t4hkxdb1g Message-ID: X-QQ-XMAILINFO: OKkKo7I1HxIeMjOTVeXWC6Xr2HPJXf7Z1mIOravcX95UqAVizHoxIBVt3O1iMe N+brrEucwxY9JjJAODjkJFI2Ml5/p7bi/oxa+K7Njk2I7SjR/CBb97B4tObAqxiMN9W8hyv9mDQL SaBR1OILkXRb61xxFb73V7qPPVZITz4WCzXWnczl55vcknJ5DOJJmoy93s0VjORlIEoMA/MKymrL gK1TZK4/RxMammsgvUERL8oR0vsJMN2wvfnu5MoLMDd06g0L6fIy/SX4uCSjEtv2pAdyoHEKk5+9 qbZHCYxaA/4XGHsMV2iyf1HOyt/WfWPaChRpNhO2CtVdB96AwVSJZr/x5fTOrDDKTxWwjL6VyqHE qn28YT3AF4LFLWIQn8oINPt2eFTlUuhWInd24baVuxV+EUsBYGHcvQXK6NhX1x9VYpkfLuktt19k LYKnrVcren0gtJYn3fe7cV27BZa605XX44MwDPhZibDNu7b99GdaMZRw5jrVvg1HRl2i9rlGqLfP sNDFuqLI9Cy5WR4QO9/FjZLoU3DzPjlt3BP0Fu7yxrULuSLkh8CIVq9ikvOQeNbvvT71Xty2lH0b lOk0Gp7cvUmQdyT/w9RSxBqtyPVtHL3Za58Wc803JA2t9YiZb0E+ZH0KlT+gc5bnjbVabN2DFKYr IRK0Ad3Ll0Li9BDj2rhnCUTki7TcCPiH1npuH0NJKblHC9xl2S78af7VhQ1L7N0vs0JEMDkWTJeE yaqo57re1eebFjxnOJAIatYpTstHZeY79ype4MzIsvgGGkki/r7qiqqRdT+eZ9ezExyHldxgfw4y m6dCXmB5GKpAD6GfK8qDxqScbruxPDahim24iANlzPinT9R7PmIRxh2BItXhEX6EAGv3z38+1DaB uo+WG/l+pmYN12/prFD7sqBXBL+hhY5PUVSdzmk0gZM8ANrhV9lDMWef86Wutsam7731RcWflaFg XMLD30Tk4= From: xkernel.wang@foxmail.com To: gregkh@linuxfoundation.org Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Xiaoke Wang Subject: [PATCH 2/3] staging: rtl8712: add two validation check in r8712_init_drv_sw() Date: Fri, 1 Apr 2022 01:07:45 +0800 X-OQ-MSGID: <20220331170745.9592-1-xkernel.wang@foxmail.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, HELO_DYNAMIC_IPADDR,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,RDNS_DYNAMIC,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaoke Wang _r8712_init_xmit_priv() or _r8712_init_recv_priv() returns -ENOMEM when some allocations inside it failed. So it is better to check the return status of them. Signed-off-by: Xiaoke Wang --- drivers/staging/rtl8712/os_intfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 9502f6a..163baaa 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -308,8 +308,12 @@ int r8712_init_drv_sw(struct _adapter *padapter) ret = r8712_init_mlme_priv(padapter); if (ret) return ret; - _r8712_init_xmit_priv(&padapter->xmitpriv, padapter); - _r8712_init_recv_priv(&padapter->recvpriv, padapter); + ret = _r8712_init_xmit_priv(&padapter->xmitpriv, padapter); + if (ret) + return ret; + ret = _r8712_init_recv_priv(&padapter->recvpriv, padapter); + if (ret) + return ret; memset((unsigned char *)&padapter->securitypriv, 0, sizeof(struct security_priv)); timer_setup(&padapter->securitypriv.tkip_timer, --