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: <20191030.114641.2012853455550097455.davem@davemloft.net>
Date:   Wed, 30 Oct 2019 11:46:41 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     michael.chan@...adcom.com
Cc:     netdev@...r.kernel.org, venkatkumar.duvvuru@...adcom.com
Subject: Re: [PATCH net-next 1/7] bnxt_en: Add support for L2 rewrite

From: Michael Chan <michael.chan@...adcom.com>
Date: Wed, 30 Oct 2019 03:59:29 -0400

> +static int
> +bnxt_fill_l2_rewrite_fields(struct bnxt_tc_actions *actions,
> +			    u8 *eth_addr, u8 *eth_addr_mask)
> +{
 ...
> +		/* FW expects dmac to be in u16 array format */
> +		p = (u16 *)&eth_addr[0];
> +		for (j = 0; j < 3; j++)
> +			actions->l2_rewrite_dmac[j] = cpu_to_be16(*(p + j));

Assumes 16-bit alignment.

>  static int bnxt_tc_parse_actions(struct bnxt *bp,
>  				 struct bnxt_tc_actions *actions,
>  				 struct flow_action *flow_action)
>  {
> +	/* Used to store the L2 rewrite mask for dmac (6 bytes) followed by
> +	 * smac (6 bytes) if rewrite of both is specified, otherwise either
> +	 * dmac or smac
> +	 */
> +	u8 eth_addr_mask[ETH_ALEN * 2] = { 0 };
> +	/* Used to store the L2 rewrite key for dmac (6 bytes) followed by
> +	 * smac (6 bytes) if rewrite of both is specified, otherwise either
> +	 * dmac or smac
> +	 */
> +	u8 eth_addr[ETH_ALEN * 2] = { 0 };
 ...
> +	if (actions->flags & BNXT_TC_ACTION_FLAG_L2_REWRITE) {
> +		rc = bnxt_fill_l2_rewrite_fields(actions, eth_addr,
> +						 eth_addr_mask);

And yet...

If you explicitly align the local ethernet address variable(s) and
this is the only path into that bnxt_fill_l2_rewrite_fields() code,
then this can work properly and portably.

But as-is, it needs to be adjusted somehow.

Thank you.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ