Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp601850pxb; Thu, 31 Mar 2022 12:39:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5XXYSLc27US2Vew2UgBaKWYxMa24ckSU1zNMYFcaWw+fg9AEPp3IiB7OoeQ+W6CLuxwsN X-Received: by 2002:a05:6402:84b:b0:419:85:b724 with SMTP id b11-20020a056402084b00b004190085b724mr18114807edz.413.1648755557210; Thu, 31 Mar 2022 12:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648755557; cv=none; d=google.com; s=arc-20160816; b=SQDiZcSSYCG+z1pdUw1BcFgBvSmRyfRf6LucsLFzSEb/BaAfOF6KUZb2EWwr2G41CP WBaTQOWPlxbT/cBaxP0Me/Xl90RY838H1a32CJctfv7LRc9/UAN9sPN1fDPI41WulFm7 Ls2Kj3Dg0Bmgd9ElyL24oPn0oIMAZ1r9XC/Rv1baR39p4na5IPk1uA+KhHFYmtm57qkU HORQiNSA/2eXjWXsIVQGx9CaidHXz/WTSp4xaXsZnIGNF33hdBM5yzs9cyEjCR2tNIKX 2K2YchVMB3g9Cc8dzjwl+JIBHFhwwh5aNBOoDzdnSNTOW0RKgBeLfD3myY3eV/W0+aLn Rskw== 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=QvhAFoLZjdOw151o/DTJnrwHUb/JOQj3RSGCcXbDplw=; b=yYuk0FqS6czaWDW/4pun0spWYk7Uqzay4G14LJanrQdQIBSqObs6r8yJ07OohgfQHY IllscnDOpZI3Eg2Nw17pDx02IJCxiUJbaByqYlvgfygoU2auvvmkVMkdpGKiitOjoYOi YL6+r3BqWV255iFP8xbu43nBQUIH4fni/eEz7Gw0JnMdCN5teUBH1mRc5ZTpbg8YVqZw YJVAsCdn8LbpjStSFsj60XrgHRhYMAk35fYfHS41nnrtgnh0W9UvIUjULEBS62avq/wR CF9R7cKYOQdTD2DJQPUUg+PY2Y/9b15qppmT8yDuABPg7YhtFkl5M/cqIyiTe1Ybkx9H Ea0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lYG3ZMRW; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056402441200b00419a55e0122si473973eda.258.2022.03.31.12.38.52; Thu, 31 Mar 2022 12:39:17 -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=@linuxfoundation.org header.s=korg header.b=lYG3ZMRW; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233394AbiCaJLD (ORCPT + 99 others); Thu, 31 Mar 2022 05:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232789AbiCaJLC (ORCPT ); Thu, 31 Mar 2022 05:11:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF6A63EB9F for ; Thu, 31 Mar 2022 02:09:15 -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 5A96961990 for ; Thu, 31 Mar 2022 09:09:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ACD7C340F2; Thu, 31 Mar 2022 09:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648717754; bh=AuOZchoDYiYjYJhdm9pzSMXcF4+iwRw1lSwSphKuXj8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lYG3ZMRWIfD3jvNxp98TSxHaWdteoiSezZEWsB2v0ZwQIzP/N+EFrILUFsV3ecq/n GpSxhbIj7RcQ5CrO1KX3+Xd9iENao8swF4V6J0BsjF5bleqm3c5d1/QaKPaRpPVnlD eWt7z7GajHWvVCbksEK8QxnLuFC6ftNNqAD2I4dc= Date: Thu, 31 Mar 2022 11:09:03 +0200 From: Greg KH To: xkernel.wang@foxmail.com Cc: dan.carpenter@oracle.com, Larry.Finger@lwfinger.net, phil@philpotter.co.uk, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: r8188eu: change the allocation type of pdata_attr 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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Thu, Mar 31, 2022 at 03:37:00PM +0800, xkernel.wang@foxmail.com wrote: > From: Xiaoke Wang > > `pdata_attr` was allocated by kzalloc() in go_add_group_info_attr(), but > there is a lack of error handlers along the call chain it lies and the > lifetime of `pdata_attr` is only in go_add_group_info_attr(). > Therefore, changing it to a local variable on stack like the other > functions in rtw_p2p.c is a possible choice, such as > `u8 p2pie[MAX_P2P_IE_LEN] = { 0x00 };` in build_probe_resp_p2p_ie() > which is the caller of go_add_group_info_attr(). > > Signed-off-by: Xiaoke Wang > --- > drivers/staging/r8188eu/core/rtw_p2p.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c > index e2b6cf2..f1a5df8 100644 > --- a/drivers/staging/r8188eu/core/rtw_p2p.c > +++ b/drivers/staging/r8188eu/core/rtw_p2p.c > @@ -27,15 +27,14 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) > struct list_head *phead, *plist; > u32 len = 0; > u16 attr_len = 0; > - u8 tmplen, *pdata_attr, *pstart, *pcur; > + u8 pdata_attr[MAX_P2P_IE_LEN] = { 0x00 }; As I said before, this is way too big to put on the stack.