All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ramesh Ramalingam" <r-ramalingam@ti.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 02/17] wifi: cc33xx: Add cc33xx.h, cc33xx_i.h
Date: Thu, 03 Dec 2026 07:31:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-247290@kernel.org> (raw)
In-Reply-To: <20261203070906.1294171-3-r-ramalingam@ti.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] wifi: cc33xx: cc33xx_rx_filter_field mixes wire layout and
  host pointer
- [Low] wifi: cc33xx: duplicate struct ieee80211_hdr_3addr as struct
  ieee80211_header
- [Low] wifi: cc33xx: CC33XX_AGGR_BUFFER_SIZE scales with host PAGE_SIZE
--

commit 4b0d2195b69f9a28c77203d691ab37987f0041e3
Author: Michael Nemanov <michael.nemanov@ti.com>

wifi: cc33xx: Add cc33xx.h, cc33xx_i.h

This commit adds the common internal header files cc33xx.h and cc33xx_i.h
defining core driver structures, hardware constants, and vif, link, and
RX filter types for the cc33xx wireless driver.

> diff --git a/drivers/net/wireless/ti/cc33xx/cc33xx.h b/drivers/net/wireless/ti/cc33xx/cc33xx.h
> new file mode 100644
> index 0000000000000..0ace1b1f557d5
> --- /dev/null
> +++ b/drivers/net/wireless/ti/cc33xx/cc33xx.h
> @@ -0,0 +1,445 @@

[ ... ]

> +#define CC33XX_AGGR_BUFFER_SIZE		(8 * PAGE_SIZE)

[Severity: Low]
Should CC33XX_AGGR_BUFFER_SIZE use a fixed size such as SZ_32K instead of
scaling with PAGE_SIZE?

On 16 KiB or 64 KiB page kernels, (8 * PAGE_SIZE) expands to 128 KiB or
512 KiB.  In commit "wifi: cc33xx: Add main.c", cc33xx_alloc_hw() passes
get_order(CC33XX_AGGR_BUFFER_SIZE) to __get_free_pages(), forcing an
order-3 contiguous allocation and wasting up to 448 KiB per device.

[ ... ]

> diff --git a/drivers/net/wireless/ti/cc33xx/cc33xx_i.h b/drivers/net/wireless/ti/cc33xx/cc33xx_i.h
> new file mode 100644
> index 0000000000000..c0d739713c2ab
> --- /dev/null
> +++ b/drivers/net/wireless/ti/cc33xx/cc33xx_i.h
> @@ -0,0 +1,415 @@

[ ... ]

> +struct ieee80211_header {
> +	__le16 frame_ctl;
> +	__le16 duration_id;
> +	u8 da[ETH_ALEN];
> +	u8 sa[ETH_ALEN];
> +	u8 bssid[ETH_ALEN];
> +	__le16 seq_ctl;
> +	u8 payload[];
> +} __packed;

[Severity: Low]
Can this reuse struct ieee80211_hdr_3addr from linux/ieee80211.h instead
of defining struct ieee80211_header?

cc33xx_i.h already includes linux/ieee80211.h via net/mac80211.h, which
defines the same 24-byte 3-address MAC header.  Using the generic
ieee80211_ prefix risks colliding with future core headers, and u8
payload[] is unused since callers only take sizeof(struct ieee80211_header).

[ ... ]

> +struct cc33xx_rx_filter_field {
> +	__le16 offset;
> +	u8 len;
> +	u8 flags;
> +	u8 *pattern;
> +} __packed;

[Severity: Medium]
Will copying pattern bytes into &field->pattern trigger a
CONFIG_FORTIFY_SOURCE warning?

struct cc33xx_rx_filter_field mixes the 4-byte wire header with a host
pointer u8 *pattern (at an unaligned 4-byte offset on 64-bit hosts).  In
commit "wifi: cc33xx: Add acx.c, acx.h", cc33xx_rx_filter_flatten_fields()
overlays it onto the firmware buffer:

drivers/net/wireless/ti/cc33xx/acx.c:cc33xx_rx_filter_flatten_fields() {
	...
	field = (struct cc33xx_rx_filter_field *)buf;
	...
	memcpy(&field->pattern, filter->fields[i].pattern, field->len);
}

Because pattern is a scalar pointer rather than a flexible array member,
suspending with a WoWLAN pattern longer than sizeof(u8 *) (up to
RX_FILTER_MAX_PATTERN_SIZE, 91 bytes) hits fortify_warn_once() (and panics
under panic_on_warn=1) via cc33xx_op_suspend() -> cc33xx_configure_wowlan().

Splitting the wire-format descriptor with a flexible array u8 pattern[]
from the host-side struct cc33xx_rx_filter_field avoids the field-spanning
write and the unaligned pointer.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203070906.1294171-1-r-ramalingam@ti.com?part=2

  reply	other threads:[~2026-12-03  7:31 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  7:08 [PATCH v6 00/17] wifi: cc33xx: Add driver for new TI CC33xx wireless device family Ramesh Ramalingam
2026-12-03  7:08 ` [PATCH v6 01/17] dt-bindings: net: wireless: cc33xx: Add ti,cc33xx.yaml Ramesh Ramalingam
2026-12-03  7:20   ` sashiko-bot
2026-12-03 18:27   ` Rob Herring
2026-12-03  7:08 ` [PATCH v6 02/17] wifi: cc33xx: Add cc33xx.h, cc33xx_i.h Ramesh Ramalingam
2026-12-03  7:31   ` sashiko-bot [this message]
2026-12-03  7:08 ` [PATCH v6 03/17] wifi: cc33xx: Add debug.h Ramesh Ramalingam
2026-12-03  7:26   ` sashiko-bot
2026-12-03  7:08 ` [PATCH v6 04/17] wifi: cc33xx: Add sdio.c, io.c, io.h Ramesh Ramalingam
2026-12-03  7:33   ` sashiko-bot
2026-12-03  7:08 ` [PATCH v6 05/17] wifi: cc33xx: Add cmd.c, cmd.h Ramesh Ramalingam
2026-12-03  7:42   ` sashiko-bot
2026-12-03  7:08 ` [PATCH v6 06/17] wifi: cc33xx: Add acx.c, acx.h Ramesh Ramalingam
2026-12-03  7:32   ` sashiko-bot
2026-12-03  7:08 ` [PATCH v6 07/17] wifi: cc33xx: Add event.c, event.h Ramesh Ramalingam
2026-12-03  7:31   ` sashiko-bot
2026-12-03  7:08 ` [PATCH v6 08/17] wifi: cc33xx: Add boot.c, boot.h Ramesh Ramalingam
2026-12-03  7:38   ` sashiko-bot
2026-12-03  7:08 ` [PATCH v6 09/17] wifi: cc33xx: Add main.c Ramesh Ramalingam
2026-12-03  9:12   ` Uwe Kleine-König
2026-12-03  7:08 ` [PATCH v6 10/17] wifi: cc33xx: Add rx.c, rx.h Ramesh Ramalingam
2026-12-03  7:33   ` sashiko-bot
2026-12-03  7:09 ` [PATCH v6 11/17] wifi: cc33xx: Add tx.c, tx.h Ramesh Ramalingam
2026-12-03  7:47   ` sashiko-bot
2026-12-03  7:09 ` [PATCH v6 12/17] wifi: cc33xx: Add init.c, init.h Ramesh Ramalingam
2026-12-03  7:43   ` sashiko-bot
2026-12-03  7:09 ` [PATCH v6 13/17] wifi: cc33xx: Add scan.c, scan.h Ramesh Ramalingam
2026-12-03  7:52   ` sashiko-bot
2026-12-03  7:09 ` [PATCH v6 14/17] wifi: cc33xx: Add conf.h Ramesh Ramalingam
2026-12-03  7:50   ` sashiko-bot
2026-12-03  7:09 ` [PATCH v6 15/17] wifi: cc33xx: Add ps.c, ps.h Ramesh Ramalingam
2026-12-03  7:43   ` sashiko-bot
2026-12-03  7:09 ` [PATCH v6 16/17] wifi: cc33xx: Add testmode.c, testmode.h Ramesh Ramalingam
2026-12-03  7:48   ` sashiko-bot
2026-12-03  7:09 ` [PATCH v6 17/17] wifi: cc33xx: Add Kconfig, Makefile Ramesh Ramalingam
2026-12-03  7:46   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-247290@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=r-ramalingam@ti.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.