Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4979539rdb; Tue, 12 Dec 2023 15:27:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6ILsd3TJgKjDCenbIuF+/oihRiuFwuczzqVNgQM8M+bcrykaUF67Wf1T+7gV3oe7oiiMN X-Received: by 2002:a05:620a:2a10:b0:77d:7a2b:2fd9 with SMTP id o16-20020a05620a2a1000b0077d7a2b2fd9mr11618182qkp.31.1702423654183; Tue, 12 Dec 2023 15:27:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702423654; cv=none; d=google.com; s=arc-20160816; b=Ldg6uMD3D3BcPlk5WXcZ/VaWSJabvA6xwa8f0eH9TKA96ln2OxmF5DNbPfHiUrU7GS r30EQI21jbsqmV7ZyVhDuyuwjj4+pbiXhYJDsvtlWLQgTe7ol+dSzzgplKRExBK0058c FjxqCxIFrUFsIslKdnzi4NcUCqPjCcXKuCGmRkL8YGYI/63NgNURsh5X3AH6xoUPF0vO KN+PqvXdmItyIq+1TKieeXlq3CrJeNs6SJHLGsEEod2b6W++NZYDeUW57J64/2Qv4GfF Z2jw08UBoGaEUDmEsZO/tSkHhXAukJDw14Ssu9v97Fo8MceD5H467j4LhR85iOCcul8i 7Tsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=SWhMvNaoYsP+58utWELVB8tF6xTUlOKZmRPgNdYB/MM=; fh=QyOmN2EuCzafS055j/N1TpqH5sEDn5nRCQsZiMaUS9g=; b=zHtDeroDCJmJ61i73WzegaouKzyvWsKZEhESPygA5JwZ69he7V0wa+hmvlq82DCWX6 ae+vVnz0Dbnbtib2FPrWPnTfbvRLVgGot0fNX3QP4bihDzVKQxXGRYRqdZQbNTHYIj5e 0GF6oMyxQF+N7BnYMBlBTfaDQgPtB/5/IFIzdw7nCFaq6eK+lWx1xlR1Ei+XUYnQQy4B UA/0BQ0S7+0MJh2MYo3xpkIS3Onl8xgTxa96t02QNQNy5QhH85HlPspifYrvi4cwmbzu 8fJkpAQpV3KLuZL2aPG1lcJpml6H7t0WcDTbpkQMKVNK2x3OV4wkLUcEbPTDs+Mx8TJD cG4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Cdw8Bx7J; spf=pass (google.com: domain of linux-wireless+bounces-718-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-718-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x18-20020a05620a14b200b0077f0670e0e8si11171484qkj.34.2023.12.12.15.27.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 15:27:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-718-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Cdw8Bx7J; spf=pass (google.com: domain of linux-wireless+bounces-718-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-718-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D3CB41C209E9 for ; Tue, 12 Dec 2023 23:27:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B4FF64734; Tue, 12 Dec 2023 23:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Cdw8Bx7J" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAFF9FD; Tue, 12 Dec 2023 15:27:27 -0800 (PST) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BCH5n9c013622; Tue, 12 Dec 2023 23:27:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:from:to:cc:references :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=SWhMvNaoYsP+58utWELVB8tF6xTUlOKZmRPgNdYB/MM=; b=Cd w8Bx7J27a3PIgZ4Ea88ItRJ5WCvxIj5nSccJKHeTsVu4XmD3MOPJ2LjaZriSb7yV iQ6ryUW/I4N+6jBRCzS5IX9hGhh5+IeJJ9WVsMsEKrJwOt8/sn8QB/v4T8Kpggqx fwIrYC9fWCmdTCMvryB2DbEsdj32GN4aOy5L4b6UZJmsXlvgocCcANbP2pvfuxNR 9EY/5yCH6msj43h9w9RlrfRpWSnn0D8NUwCpRrKunzPa+x87wU3/09sk66XfEDM8 iAHpQ3LmiDMRyIc2siukc+zOfCuFAUf0J7Tby33lSgbBJUOSKggOID8TORraEC4J FUI+epEv7MhrcDQCOqsw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uxctatx5g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Dec 2023 23:27:02 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BCNR1VO024896 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Dec 2023 23:27:01 GMT Received: from [10.110.106.103] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 12 Dec 2023 15:27:00 -0800 Message-ID: Date: Tue, 12 Dec 2023 15:26:59 -0800 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC - is this a bug?] wifi: ath10k: Asking for some light on this, please :) Content-Language: en-US From: Jeff Johnson To: "Gustavo A. R. Silva" , Johannes Berg , Kalle Valo CC: , , , "Gustavo A. R. Silva" , References: <626ae2e7-66f8-423b-b17f-e75c1a6d29b3@embeddedor.com> <26b15f4702cef17fe70b496a62f03735874bd16a.camel@sipsolutions.net> <07e9bb04-f9fc-46d5-bfb9-a00a63a707c0@embeddedor.com> <8219c79e-0359-4136-afa4-fba76fde191a@embeddedor.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 5ea7PuvC2gPKd5hS6zoaxzmbgueU3cQu X-Proofpoint-ORIG-GUID: 5ea7PuvC2gPKd5hS6zoaxzmbgueU3cQu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 bulkscore=0 mlxscore=0 adultscore=0 suspectscore=0 priorityscore=1501 clxscore=1011 mlxlogscore=789 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312120183 On 10/25/2023 8:52 AM, Jeff Johnson wrote: > On 10/24/2023 7:37 PM, Gustavo A. R. Silva wrote: >> >> >> On 10/24/23 14:49, Johannes Berg wrote: >>> On Tue, 2023-10-24 at 14:41 -0600, Gustavo A. R. Silva wrote: >>>> >>>> It seems we run into the same issue in the function below, even in the >>>> case this `memset()` is unnecessary (which it seems it's not): >>>> >>>>     8920         memset(skb->data, 0, sizeof(*cmd)); >>>> >>>> Notice that if `cap->peer_chan_len == 0` or `cap->peer_chan_len == 1`, >>>> in the original code, we have `len == sizeof(*cmd) == 128`: >>> >>> Right. >>> >>>> -       /* tdls peer update cmd has place holder for one channel*/ >>>> -       chan_len = cap->peer_chan_len ? (cap->peer_chan_len - 1) : 0; >>>> - >>>> -       len = sizeof(*cmd) + chan_len * sizeof(*chan); >>>> +       len = struct_size(cmd, peer_capab.peer_chan_list, >>>> cap->peer_chan_len); >>>> >>>>           skb = ath10k_wmi_alloc_skb(ar, len); >>>>           if (!skb) >>>> >>>> which makes `round_len == roundup(len, 4) == struct_size(cmd,...,...) >>>> == 104` >>>> when `cap->peer_chan_len == 0` >>> >>> And yeah, that's really the issue, it only matters for ==0. For a moment >>> there I thought that doesn't even make sense, but it looks like it never >>> even becomes non-zero. >>> >>> No idea then, sorry. You'd hope firmware doesn't care about the actual >>> message size if the inner data says "0 entries", but who knows? And how >>> many firmware versions are there? :) >>> >>> So I guess you'd want to stay compatible, even if it means having a >>> >>>     chan_len = min(cap->peer_chan_len, 1); >>> >>> for the struct_size()? >> >> Yeah, that's an alternative. >> >> I'll wait for the maintainers to chime in and see if they have a different >> opinion. > > I'm seeing clarification from the development team. > > /jeff > I was not able to get a response from the firmware team. I have gone ahead and created a series of patches to fix the remaining flexible array issues in ath10k including the one discussed here. I should be able to post those sometime this week. /jeff