Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3531023pxb; Mon, 4 Apr 2022 20:07:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1HLnqyiWY8fhIzym9iKy/6afvVnyBS1joudAfUvTT3AWeG4Y9MRVIsr0L6coMsAs7FYon X-Received: by 2002:a62:1d09:0:b0:4fd:8b00:d28 with SMTP id d9-20020a621d09000000b004fd8b000d28mr1478768pfd.81.1649128053193; Mon, 04 Apr 2022 20:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649128053; cv=none; d=google.com; s=arc-20160816; b=PkSRwye2jjAk60rD7Fe6g1rVufmI2ZXwAc3MXJrU7257/cAkkRoZ4JJG0abOo3WFto z/hJzVjU1sPHfLT6Wglf7H0WpD3JI+GpPFtUGc/hp2J1ZuVSx12iJD0LtHuScpyCqbZC lXZrjvZaRoOyk3tH5cEa3ykdpLm+oB8F7jbssWWHJnvzcNL94070XDI9+DWN9zLfGAib ftLfSCkaHEn2VX/gJy63iKpBHAC8Xes3zJVMROHRR4ToB5RYZkuA6HPOIWdB5XvOM74T nZelfTIZWgrpiZZfHvzV0LjR6xye3lBFidIcK91WY726rHll5moR2B96Lopu2ue0FL3H 5P+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Azh/v0YBCtzlWBpMR10kN6wL2tyUbvFYERlff83OxpQ=; b=dvZsHrlqE1rmtLj4FnNzvSqRX4CjvvPR10OwGkJKdsZeWlwwtslkPFhxfCyxaC8pYR 2yDI7hfU/cTtLqWw+UY25EW256yR7bGvb3dgwtuoRV7chFmZ3FWYVhA3xhrUlB8iSXtW 9eARU3ua1//ATAB4UBBgUyJrR+SPQtKtqomTyZ2bQ85/QEzFxNgPfIR4uYzhjJI+l9Iq PZ+cQyN0pFoxqTvUMryieWUv03W5K+oD7j5eo139CdoIrLsveOQSRb6F/lVRhgmRUw0r YEdNvNT7nAWaDFb5uYeIwr6a/lBz94vKnTMOp5/MKfKzRkgCJOpOdso06CRea+/TLIND vJUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GsTHmvgf; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 62-20020a630541000000b003816043ee99si11844793pgf.142.2022.04.04.20.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 20:07:33 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GsTHmvgf; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1FD373682C6; Mon, 4 Apr 2022 18:31:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350864AbiDDOck (ORCPT + 99 others); Mon, 4 Apr 2022 10:32:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377491AbiDDOcT (ORCPT ); Mon, 4 Apr 2022 10:32:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 042D132ECB for ; Mon, 4 Apr 2022 07:30:23 -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 ams.source.kernel.org (Postfix) with ESMTPS id B0ABFB8172B for ; Mon, 4 Apr 2022 14:30:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23C47C2BBE4; Mon, 4 Apr 2022 14:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649082620; bh=IcyeBgAAHvxYwTuDheUzskHb8csMKwWLHu5b7gmdrPc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GsTHmvgfz6NoHTcPiSkjvpj1w8YRqu+NyMyFORt01iwcWnSjP52tpYcBJcznduvEx SCTXFaChc89lRt6EoZJAaQ1apaHvnHqX6QlieQR3l1CfIh9jMs5yjNfGR7DHU/p17s sk+WrsCppy8BXrs0P4eYX/lbJc8C8viaEHTnVARs= Date: Mon, 4 Apr 2022 16:30:17 +0200 From: Greg KH To: xkernel.wang@foxmail.com Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] staging: rtl8712: change the type of _r8712_init_recv_priv() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 On Fri, Apr 01, 2022 at 01:06:35AM +0800, xkernel.wang@foxmail.com wrote: > From: Xiaoke Wang > > There is a memory allocation in _r8712_init_recv_priv(). Since the > original type of this function is void, now it is changed to int to > make the error of allocation failures propagate to its caller easily. > > Signed-off-by: Xiaoke Wang > --- > drivers/staging/rtl8712/recv_osdep.h | 2 +- > drivers/staging/rtl8712/rtl871x_recv.c | 5 +++-- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/rtl8712/recv_osdep.h b/drivers/staging/rtl8712/recv_osdep.h > index d8c1fa7..f5b97c5 100644 > --- a/drivers/staging/rtl8712/recv_osdep.h > +++ b/drivers/staging/rtl8712/recv_osdep.h > @@ -18,7 +18,7 @@ > #include "drv_types.h" > #include > > -void _r8712_init_recv_priv(struct recv_priv *precvpriv, > +int _r8712_init_recv_priv(struct recv_priv *precvpriv, > struct _adapter *padapter); > void _r8712_free_recv_priv(struct recv_priv *precvpriv); > void r8712_recv_entry(union recv_frame *precv_frame); > diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c > index c23f6b3..dd8cb07 100644 > --- a/drivers/staging/rtl8712/rtl871x_recv.c > +++ b/drivers/staging/rtl8712/rtl871x_recv.c > @@ -44,7 +44,7 @@ void _r8712_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) > _init_queue(&psta_recvpriv->defrag_q); > } > > -void _r8712_init_recv_priv(struct recv_priv *precvpriv, > +int _r8712_init_recv_priv(struct recv_priv *precvpriv, > struct _adapter *padapter) > { > sint i; > @@ -60,7 +60,7 @@ void _r8712_init_recv_priv(struct recv_priv *precvpriv, > sizeof(union recv_frame) + RXFRAME_ALIGN_SZ, > GFP_ATOMIC); > if (!precvpriv->pallocated_frame_buf) > - return; > + return -ENOMEM; > kmemleak_not_leak(precvpriv->pallocated_frame_buf); Why are you still telling kmemleak that this was not a leak if you properly handle it? thanks, greg k-h