lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250611144635.37207d22@kernel.org>
Date: Wed, 11 Jun 2025 14:46:35 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Álvaro Fernández Rojas <noltari@...il.com>
Cc: jonas.gorski@...il.com, florian.fainelli@...adcom.com, andrew@...n.ch,
 olteanv@...il.com, davem@...emloft.net, edumazet@...gle.com,
 pabeni@...hat.com, horms@...nel.org, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, dgcbueu@...il.com
Subject: Re: [PATCH net-next v2 2/3] net: dsa: tag_brcm: add support for
 legacy FCS tags

On Tue, 10 Jun 2025 18:31:53 +0200 Álvaro Fernández Rojas wrote:
> +	struct dsa_port *dp = dsa_user_to_port(dev);
> +	unsigned int fcs_len;
> +	u32 fcs_val;
> +	u8 *brcm_tag;

nit: please reorder the variable declaration lines longest to shortest

> +	/* The Ethernet switch we are interfaced with needs packets to be at
> +	 * least 64 bytes (including FCS) otherwise they will be discarded when
> +	 * they enter the switch port logic. When Broadcom tags are enabled, we
> +	 * need to make sure that packets are at least 70 bytes
> +	 * (including FCS and tag) because the length verification is done after
> +	 * the Broadcom tag is stripped off the ingress packet.
> +	 *
> +	 * Let dsa_user_xmit() free the SKB
> +	 */
> +	if (__skb_put_padto(skb, ETH_ZLEN + BRCM_LEG_TAG_LEN, false))
> +		return NULL;
> +
> +	fcs_len = skb->len;
> +	fcs_val = cpu_to_le32(crc32(~0, skb->data, fcs_len) ^ ~0);

sparse (C=1 build flag) complains about the loss of type annotation:

net/dsa/tag_brcm.c:327:17: warning: incorrect type in assignment (different base types)
net/dsa/tag_brcm.c:327:17:    expected unsigned int [usertype] fcs_val
net/dsa/tag_brcm.c:327:17:    got restricted __le32 [usertype]

> +	skb_push(skb, BRCM_LEG_TAG_LEN);
> +
> +	dsa_alloc_etype_header(skb, BRCM_LEG_TAG_LEN);
> +
> +	brcm_tag = skb->data + 2 * ETH_ALEN;
> +
> +	/* Broadcom tag type */
> +	brcm_tag[0] = BRCM_LEG_TYPE_HI;
> +	brcm_tag[1] = BRCM_LEG_TYPE_LO;
> +
> +	/* Broadcom tag value */
> +	brcm_tag[2] = BRCM_LEG_EGRESS | BRCM_LEG_LEN_HI(fcs_len);
> +	brcm_tag[3] = BRCM_LEG_LEN_LO(fcs_len);
> +	brcm_tag[4] = 0;
> +	brcm_tag[5] = dp->index & BRCM_LEG_PORT_ID;
> +
> +	/* Original FCS value */
> +	if (__skb_pad(skb, ETH_FCS_LEN, false))
> +		return NULL;
> +	skb_put_data(skb, &fcs_val, ETH_FCS_LEN);
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ