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: <20190815.123235.516041583959546572.davem@davemloft.net>
Date:   Thu, 15 Aug 2019 12:32:35 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     terry.s.duncan@...ux.intel.com
Cc:     sam@...dozajonas.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, openbmc@...ts.ozlabs.org,
        wak@...gle.com, joel@....id.au
Subject: Re: [PATCH] net/ncsi: Ensure 32-bit boundary for data cksum

From: "Terry S. Duncan" <terry.s.duncan@...ux.intel.com>
Date: Tue, 13 Aug 2019 18:18:40 -0700

> The NCSI spec indicates that if the data does not end on a 32 bit
> boundary, one to three padding bytes equal to 0x00 shall be present to
> align the checksum field to a 32-bit boundary.
> 
> Signed-off-by: Terry S. Duncan <terry.s.duncan@...ux.intel.com>
> ---
>  net/ncsi/internal.h |  1 +
>  net/ncsi/ncsi-cmd.c |  2 +-
>  net/ncsi/ncsi-rsp.c | 12 ++++++++----
>  3 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h
> index 0b3f0673e1a2..468a19fdfd88 100644
> --- a/net/ncsi/internal.h
> +++ b/net/ncsi/internal.h
> @@ -185,6 +185,7 @@ struct ncsi_package;
>  #define NCSI_TO_CHANNEL(p, c)	(((p) << NCSI_PACKAGE_SHIFT) | (c))
>  #define NCSI_MAX_PACKAGE	8
>  #define NCSI_MAX_CHANNEL	32
> +#define NCSI_ROUND32(x)		(((x) + 3) & ~3) /* Round to 32 bit boundary */

I think we have enough of a proliferation of alignment macros, let's not add more.

Either define this to "ALIGN(x, 4)" or expand that into each of the locations:

>  	pchecksum = (__be32 *)((void *)h + sizeof(struct ncsi_pkt_hdr) +
> -		    nca->payload);
> +		    NCSI_ROUND32(nca->payload));

		     ALIGN(nca->payload, 4)

> -	pchecksum = (__be32 *)((void *)(h + 1) + payload - 4);
> +	pchecksum = (__be32 *)((void *)(h + 1) + NCSI_ROUND32(payload) - 4);

						 ALIGN(payload, 4)


etc.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ