Re: [PATCH V3 net-next 02/15] smc: establish new socket family

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ursula Braun <ubraun@xxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Nov 2016 16:06:32 +0100

> +static struct sock *smc_sock_alloc(struct net *net, struct socket *sock)
> +{
> +	struct smc_sock *smc;
> +	struct sock *sk;
> +
> +	sk = sk_alloc(net, PF_SMC, GFP_KERNEL, &smc_proto, 0);
> +	if (!sk)
> +		return NULL;
> +
> +	sock_init_data(sock, sk); /* sets sk_refcnt to 1 */
> +	sk->sk_state = SMC_INIT;
> +	sk->sk_destruct = smc_destruct;
> +	sk->sk_protocol = SMCPROTO_SMC;
> +	sk_refcnt_debug_inc(sk);
> +
> +	smc = smc_sk(sk);
> +	smc->clcsock = NULL;
> +	smc->use_fallback = 0;

This is unnecessary, sk_alloc() clears out the memory for you.

> +static int smc_bind(struct socket *sock, struct sockaddr *uaddr,
> +		    int addr_len)
> +{
 ...
> +	smc->clcsock->sk->sk_reuse = sk->sk_reuse;
> +	rc = kernel_bind(smc->clcsock, uaddr, addr_len);

Is it valid to assume smc->clcsock is not NULL right here?

> +struct smc_sock {				/* smc sock container */
> +	struct sock		sk;
> +	struct socket		*clcsock;	/* internal tcp socket */
> +	u8			use_fallback : 1; /* fallback to tcp */
> +};

Please use 'bool' and true/false for 'use_fallback'.
--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux