Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2928149rdb; Tue, 6 Feb 2024 01:52:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGu4AqJLEuxzTyNnm2fYK3b+2jNGOxXIagOIF7Wmv1IvsNsRCqPxxoe7Zq2mkfYjB3PtUNz X-Received: by 2002:a17:906:6acf:b0:a36:c353:952e with SMTP id q15-20020a1709066acf00b00a36c353952emr1506586ejs.41.1707213164189; Tue, 06 Feb 2024 01:52:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707213164; cv=pass; d=google.com; s=arc-20160816; b=X9M/1K4w0QxGbx89Z9tCc2tpskQ6zA9HUolb3uC07VBmeeIV6xbpmkY4Q/M3hTmREN U05hTgfzMvZtLmstTFKTzUucYkyOZlv3wVw1DKvosEP0DymPcuZJI3Y3HLzCZeIKOVL0 hPLZAmmA8r8CuEuH5SKPEyT/ZeCstG6oEpP31YCJXXt+e8H7u3Yz/P0i36mjOQv5VFXI JpAyaSguAsL+3ijT+5bV/b7n0VXK1ljm++L8mOvqX3hGfZdlwACx0cOqQ/GZoTeQ7UUp 49j1R+H4EwvmgpJDBseyY6wu/k/a4zhwgGSDnAt/WCqd2AoEdM6jpH5yW67oRFd5Slqu g0lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=1wnFNW+1fnJZocpdQg87jZETpkuwT6mfERde5db7Cog=; fh=XV0fWiJIMcWOMYByD9igL/hihqN+PVwbVrBoMdz5jrk=; b=ncqdaz1mPU54saKsgJWgyHoXd/PzoLTxDbufpNT61MrehWKMvFqgO0XPWBNfImIsOW o/HzjPD1U57cI5j3623M4vefydgOCxK6m9nZzdSKPniJ0ALIp44Jx8iBjo4xEV6bH/gM rbDjIHvOM0o3pClthJxK42L09IRgMh865zH+ttLHzS3POTzFAZg9D5BA9U0V04wrgQah 3OT+odJLDLb0TLov8WySSVWMFqnOsl3DjE08/pMgJTpRheCQX0Z6NVZgtEAJplsbVu8Y LjI/Hbi6eVJYgM8J2XBfYUHoYNGDD4v4WiU5QYr5/0UDNMOfsJdjdNcxB+dmPm5vNjhi 2ToQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HC2hARrF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-3212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3212-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVOO/ePvpupL3xvRIYvin5r4ZInkq5w+x+YlvEe7j6df2LMI1jgQ84h8OWMTB0opovXdL3H3Zx/8wNEAq8dYrVBg201r5ave+WOipP/Zw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n24-20020a170906b31800b00a36481cbeacsi835813ejz.426.2024.02.06.01.52.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:52:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HC2hARrF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-3212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3212-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id EC0C11F22059 for ; Tue, 6 Feb 2024 09:52:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59B7F12D169; Tue, 6 Feb 2024 09:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HC2hARrF" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3496812D148 for ; Tue, 6 Feb 2024 09:52:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707213159; cv=none; b=fxZ3TBv02OU5VgCVluxgu2nDnCdH275S444KLnyz2SxuhfskosVucYkTtxQaDVzOXuIZndSQQx3qMI/k4YzysW4U7Z7vMKN8m52kyQSa53V0/nbf+Jemo6SzhMeNq2cHJe2MjWkI9AR+VFExiY2Z2Xks+696CXggkEWjD7X1lmU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707213159; c=relaxed/simple; bh=b+p8zjmnr16Jk65ZJAFJ5YGzcFg8oIMlI1ka67QX4lQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=PdRTHy3a9yNdwDgCsxJZSTudtWIqncIV2LhAyjC8YcNiMs2x6r2tsIY85GTmq1t2hwGoKHAAomUfxv8fRR2ritNo0SAZ5pKCzfeQAaW0yWJW75QvF40QT8YR+eEumVtK+G5UzeNKd1y5RNB6EOYdRdObzqQk0ZCy8JuPZo9zD1o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HC2hARrF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD226C433C7; Tue, 6 Feb 2024 09:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707213158; bh=b+p8zjmnr16Jk65ZJAFJ5YGzcFg8oIMlI1ka67QX4lQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=HC2hARrFbha5PfULz3DckvOgV1s976iyk+o09fYqstunU4RVGN87vbZW3DvT9idRU xclfkxGqIX4z1ZYK+s1y6HaQ72D2R5EE1Gb/uNPyJfCfDkK6+oaU+Y5EHWbMyOYelF 3Vq6uI/+5RMhScGShIWSHuXX/A7LyGCQHkokZx6H3shtAXJDu5I6jtzpqpnXGbbsST jQN73REl1bArgr9qVPf+sAdYIM8K2x+kHCEFl3upX3wtEhK4bIwm4irsh6GldC4B28 pBMyVFGD8hqxstW/at8idJ8YXl2jmuIQ0w68w60VreKEBu3p++ECbvtdeJ+BjZ2KiN 54tIGtuH0bvGw== From: Kalle Valo To: Jeff Johnson Cc: Kang Yang , , Subject: Re: [PATCH v6 04/11] wifi: ath12k: add P2P IE in beacon template References: <20240130040303.370590-1-quic_kangyang@quicinc.com> <20240130040303.370590-5-quic_kangyang@quicinc.com> <87bk8usx6d.fsf@kernel.org> Date: Tue, 06 Feb 2024 11:52:35 +0200 In-Reply-To: (Jeff Johnson's message of "Mon, 5 Feb 2024 08:35:07 -0800") Message-ID: <8734u5syvw.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Jeff Johnson writes: > On 2/5/2024 8:17 AM, Kalle Valo wrote: >> Kang Yang writes: >>> + if (WARN_ON(skb->len < ie_offset)) >>> + return -EINVAL; >>> + >>> + ie = (u8 *)cfg80211_find_vendor_ie(oui, oui_type, >>> + skb->data + ie_offset, >>> + skb->len - ie_offset); >> >> So cfg80211_find_vendor_ie() returns: >> >> static inline const u8 * >> cfg80211_find_vendor_ie(unsigned int oui, int oui_type, >> const u8 *ies, unsigned int len) >> >> You are casting away the const here. I see that other drivers do the >> same as the assumption is that the pointer points to the same buffer, >> but I still don't really like casting away const. Thoughts? > > I'm not a fan of typecasting either. > > However, the problem here is that from the perspective of > cfg80211_find_vendor_ie() the buffer is const (not modified in any way > by the function), but from the perspective of every caller the buffer is > part of a message that is in RAM. > > So you have to decide if you want to change the prototype to remove the > const from cfg80211_find_vendor_ie() or if you want to keep the current > semantic to cast away the const. > > This is one of the rare cases where I think the typecast is ok. Makes sense, thanks for the comment. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches