Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2127192rda; Tue, 24 Oct 2023 13:12:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPsyDiZIACNKx1xxfp6JQqV9tdCIaLl0m8sXngpDXu+AosXGO4jHhJPWSGSk4FDh5vNPft X-Received: by 2002:a17:903:28c4:b0:1b8:66f6:87a3 with SMTP id kv4-20020a17090328c400b001b866f687a3mr10883876plb.52.1698178323492; Tue, 24 Oct 2023 13:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698178323; cv=none; d=google.com; s=arc-20160816; b=ZkpZaY24SWFZSSX1WdLtPuHKYiMQlVZO1rSqNubTxKKNtJNG2gfc6MGODdxmWMb8s6 NTnFrBWibb0VkS4ownGCE8d+J+QNyxJ3ZAsBs7ufvxXF3qSN/9nqhRDIu48DTsY0Hpfx YVI2230+G1xxivnflrZJskszQpko36xXINGBPIzfhRVJTQeT+n6BsRw4UqDWn9DBgTqn xcfoCrkplNKueVgHPYTKNJARLejUekCEduyZ6v6KgCnEZdcna6O6YY1o7CeqGe86kZaz Pd/jiNtNk5F+jPbhHtRhJlegix+gTz8smSDKBYj0ChePk0WJejBmXhFdXXMmj/6Ry+Zs rxiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=nfdtctD5s+siSQUr/kengnC4iQIqyN5aDOBCjVSm0Aw=; fh=E6KwE/YkKVDwjSNB2hYCLG8ZIk3KpZ/KRyrtgKZSq4E=; b=LKX8VQK9yY7fslAbzr5shuxnhalOW8jRN+6Jlbptm9MOsPE59DJktFnZTs5lUMfKsZ 7Pus4dXrmAuz/oOjdchcnCH6heaJgD6ZCa2HzX8lVKmYKCTQXuT7vnjiYVc6b/LLarw7 Uh+qwFlkzQAK0R9C4XQWT18faHwUG70vQNL27LRO1Rsm4AOFzNyu5q0PUHbt0ez11z3/ HI/Nrc7MojiOWSgEe+S/aOzLQsJEmYpgEehSNEvQN9YuCzvr5Uw3ecHicrNLXM8Alu+y Ys2GtcdkbEO3xgD9CicwlZChVYYMus6nv/awqZm7fUFZXde0P8/6DJwF7P1UaPq/riQy JUMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=CW1rVgPN; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id b2-20020a170902650200b001bf741231f7si8898594plk.570.2023.10.24.13.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 13:12:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=CW1rVgPN; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7108F8025B4B; Tue, 24 Oct 2023 13:11:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344256AbjJXULt (ORCPT + 52 others); Tue, 24 Oct 2023 16:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343896AbjJXULs (ORCPT ); Tue, 24 Oct 2023 16:11:48 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99CD8A2; Tue, 24 Oct 2023 13:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=nfdtctD5s+siSQUr/kengnC4iQIqyN5aDOBCjVSm0Aw=; t=1698178306; x=1699387906; b=CW1rVgPN9ACYbDs9KcCyOkgT54qDYgMO+Ev59qad5F9x/xQ egyesXxAAE6rTo4Dw/o/1/3ZEe/ft+CJnamQ5mYdmM69n+uEwXTTJ7wUvqIdDLKAvHedExeTbm17r vrUxxXm6LZqzNYhiQ6vDpkBFNf+gfrhMztsZw/Q7XfTBFMW4Tega6OxwuECBtHol1yzlyDZ1FTEFl R3FhUKoFufDFRG5PlI9W2H3OlLVprEUcJ8g1HeSn1Xyka91qRZ0cq1ycC3uDjXNol5vR1M4Tbbwgw vGFUCibVGLoOOQ439aJQtRJkcpoc7cqiqU/KBto4JFn03ajqWoK1YXptuhJTzpQg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97-RC1) (envelope-from ) id 1qvNkZ-00000001akU-3Ra3; Tue, 24 Oct 2023 22:11:40 +0200 Message-ID: <26b15f4702cef17fe70b496a62f03735874bd16a.camel@sipsolutions.net> Subject: Re: [RFC - is this a bug?] wifi: ath10k: Asking for some light on this, please :) From: Johannes Berg To: "Gustavo A. R. Silva" , Kalle Valo , Jeff Johnson Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Date: Tue, 24 Oct 2023 22:11:38 +0200 In-Reply-To: <626ae2e7-66f8-423b-b17f-e75c1a6d29b3@embeddedor.com> References: <626ae2e7-66f8-423b-b17f-e75c1a6d29b3@embeddedor.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 13:11:59 -0700 (PDT) On Tue, 2023-10-24 at 13:50 -0600, Gustavo A. R. Silva wrote: > Hi all, >=20 > While working on tranforming one-element array `peer_chan_list` in > `struct wmi_tdls_peer_capabilities` into a flex-array member >=20 > 7187 struct wmi_tdls_peer_capabilities { > ... > 7199 struct wmi_channel peer_chan_list[1]; > 7200 } __packed; >=20 > the following line caught my attention: >=20 > ./drivers/net/wireless/ath/ath10k/wmi.c: > 8920 memset(skb->data, 0, sizeof(*cmd)); >=20 > Notice that before the flex-array transformation, we are zeroing 128 > bytes in `skb->data` because `sizeof(*cmd) =3D=3D 128`, see below: > So, my question is: do we really need to zero out those extra 24 bytes in > `skb->data`? or is it rather a bug in the original code? >=20 If we look a step further, I _think_ even that memset is unnecessary? struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len) { struct sk_buff *skb; u32 round_len =3D roundup(len, 4); skb =3D ath10k_htc_alloc_skb(ar, WMI_SKB_HEADROOM + round_len); if (!skb) return NULL; skb_reserve(skb, WMI_SKB_HEADROOM); if (!IS_ALIGNED((unsigned long)skb->data, 4)) ath10k_warn(ar, "Unaligned WMI skb\n"); skb_put(skb, round_len); memset(skb->data, 0, round_len); return skb; } So shouldn't the outgoing skb be exactly the same? Anyway, just looking at the code out of curiosity, I don't actually know anything about this driver :) johannes