sctp: change return type of sctp_get_port_local
Currently sctp_get_port_local() returns a long
which is either 0,1 or a pointer casted to long.
It's neither of the callers use the return value since
commit 62208f1245
("net: sctp: simplify sctp_get_port").
Now two callers are sctp_get_port and sctp_do_bind,
they actually assumend a casted to an int was the same as
a pointer casted to a long, and they don't save the return
value just check whether it is zero or non-zero, so
it would better change return type from long to int for
sctp_get_port_local.
Signed-off-by: Mao Wenan <maowenan@huawei.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8f6617badc
commit
8e2ef6abd4
|
@ -309,7 +309,7 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static long sctp_get_port_local(struct sock *, union sctp_addr *);
|
||||
static int sctp_get_port_local(struct sock *, union sctp_addr *);
|
||||
|
||||
/* Verify this is a valid sockaddr. */
|
||||
static struct sctp_af *sctp_sockaddr_af(struct sctp_sock *opt,
|
||||
|
@ -7999,7 +7999,7 @@ static void sctp_unhash(struct sock *sk)
|
|||
static struct sctp_bind_bucket *sctp_bucket_create(
|
||||
struct sctp_bind_hashbucket *head, struct net *, unsigned short snum);
|
||||
|
||||
static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
|
||||
static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
|
||||
{
|
||||
struct sctp_sock *sp = sctp_sk(sk);
|
||||
bool reuse = (sk->sk_reuse || sp->reuse);
|
||||
|
@ -8109,7 +8109,7 @@ pp_found:
|
|||
|
||||
if (sctp_bind_addr_conflict(&ep2->base.bind_addr,
|
||||
addr, sp2, sp)) {
|
||||
ret = (long)sk2;
|
||||
ret = 1;
|
||||
goto fail_unlock;
|
||||
}
|
||||
}
|
||||
|
@ -8181,7 +8181,7 @@ static int sctp_get_port(struct sock *sk, unsigned short snum)
|
|||
addr.v4.sin_port = htons(snum);
|
||||
|
||||
/* Note: sk->sk_num gets filled in if ephemeral port request. */
|
||||
return !!sctp_get_port_local(sk, &addr);
|
||||
return sctp_get_port_local(sk, &addr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue