netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: netdev@vger.kernel.org, linux-crypto@vger.kernel.org,
	herbert@gondor.apana.org.au, edumazet@google.com,
	davem@davemloft.net, kuznet@ms2.inr.ac.ru,
	yoshfuji@linux-ipv6.org, jbaron@akamai.com, cpaasch@apple.com,
	David.Laight@aculab.com, ycheng@google.com
Subject: Re: [PATCH net-next v2 1/1] net: fastopen: robustness and endianness fixes for SipHash
Date: Wed, 19 Jun 2019 10:25:39 -0700	[thread overview]
Message-ID: <20190619172538.GA33328@gmail.com> (raw)
In-Reply-To: <20190619065510.23514-2-ard.biesheuvel@linaro.org>

On Wed, Jun 19, 2019 at 08:55:10AM +0200, Ard Biesheuvel wrote:
>  int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk,
> -			      void *primary_key, void *backup_key,
> -			      unsigned int len)
> +			      void *primary_key, void *backup_key)
>  {
>  	struct tcp_fastopen_context *ctx, *octx;
>  	struct fastopen_queue *q;
> @@ -81,9 +79,15 @@ int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk,
>  		goto out;
>  	}
>  
> -	memcpy(ctx->key[0], primary_key, len);
> +	ctx->key[0] = (siphash_key_t){
> +		get_unaligned_le64(primary_key),
> +		get_unaligned_le64(primary_key + 8)
> +	};
>  	if (backup_key) {
> -		memcpy(ctx->key[1], backup_key, len);
> +		ctx->key[1] = (siphash_key_t){
> +			get_unaligned_le64(backup_key),
> +			get_unaligned_le64(backup_key + 8)
> +		};
>  		ctx->num = 2;
>  	} else {
>  		ctx->num = 1;

These initializers are missing a level of braces.

Otherwise this patch looks good to me.

net/ipv4/tcp_fastopen.c: In function ‘tcp_fastopen_reset_cipher’:
net/ipv4/tcp_fastopen.c:82:16: warning: missing braces around initializer [-Wmissing-braces]
  ctx->key[0] = (siphash_key_t){
                ^
   get_unaligned_le64(primary_key),
   {
net/ipv4/tcp_fastopen.c:85:2:
  };
  }
net/ipv4/tcp_fastopen.c:87:17: warning: missing braces around initializer [-Wmissing-braces]
   ctx->key[1] = (siphash_key_t){
                 ^
    get_unaligned_le64(backup_key),
    {
net/ipv4/tcp_fastopen.c:90:3:
   };
   }

  reply	other threads:[~2019-06-19 17:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19  6:55 [PATCH net-next v2 0/1] net: fastopen: follow-up tweaks for SipHash switch Ard Biesheuvel
2019-06-19  6:55 ` [PATCH net-next v2 1/1] net: fastopen: robustness and endianness fixes for SipHash Ard Biesheuvel
2019-06-19 17:25   ` Eric Biggers [this message]
2019-06-19 21:42   ` David Miller
2019-06-19 21:47     ` Ard Biesheuvel
2019-06-20 23:03   ` kbuild test robot

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=20190619172538.GA33328@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=cpaasch@apple.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jbaron@akamai.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-crypto@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ycheng@google.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).