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:
};
}