Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2325919ybe; Thu, 12 Sep 2019 07:54:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPpZuGew1uZuNlA4GKf1y4sf1DtJbl4F+e4LSZrOiPRmvUQwj48PcFziaOAjWDbqa2tWo5 X-Received: by 2002:a17:906:480b:: with SMTP id w11mr35265676ejq.137.1568300054391; Thu, 12 Sep 2019 07:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568300054; cv=none; d=google.com; s=arc-20160816; b=JM/ZkM6Hwub5lZinzfXaee1tcy4eRxLfFrqRO/qzoGtCVAhf6F4t6M5hofPddSxlYb e2uOGcixzF3thBY9fCB5lya6ZrwHCWdbtxd4MV09je4Cjpby1Z9Oi/IDhczNZGU+PWWk B+rBEjGLurh4pQXvaM3ZNO6GcllQCiGi/3VseNeJBWjtGYsPpB6y+jGKaPVp9Bow1kHz q2+gBaVa+saTONlV3AkTJKSIX2ws6tT5QYIGTKmumAKAinI7Dx6U1exxnF//Z4RZZDz+ CKH97N4BmxdA87kBgiFFTBk0pidfEpadK2UE1E6ANnzzMi9GQQvWD+Po0waD7VFQTEqm X9XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=flpHUM3jIkqI5icvoEOQORa60za63cCS1Ns8QwP4lnY=; b=Nymw0OfJZTzMgNadPV2HRE0GXxxAUTNFbq7mr4UM7Ikl7Wdbz0kSB+rxuU39xbNZZA oRTwCPptqD9sutX97/2O24d1mPpBh0+D89YvSTevp4Zx+FJTOI5rpRnzqniKSTOUDGCG hE6ucuovt19JN4gIzOyEi5AXcqy5rroRrDhLFxhjx+1yU7qMiqGSeEgqrKIiaOc7uDBL JfJn5+w/xo7FLI8lkddPiXkmrDXDsrV38xIhTJzQLe0TWR7xLJLqf0bLq28q28LSuju/ VUQKG6jxSsEZJwSD5XNPe7/wTCtPTFp9+sVQtNTmhLUUgTKuVzponMq3rO8dhFc56zdh LH4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ky9CpUPU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k6si13087106ejj.177.2019.09.12.07.53.50; Thu, 12 Sep 2019 07:54:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ky9CpUPU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732819AbfILOvw (ORCPT + 99 others); Thu, 12 Sep 2019 10:51:52 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39239 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732444AbfILOvw (ORCPT ); Thu, 12 Sep 2019 10:51:52 -0400 Received: by mail-qk1-f195.google.com with SMTP id 4so24722387qki.6; Thu, 12 Sep 2019 07:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=flpHUM3jIkqI5icvoEOQORa60za63cCS1Ns8QwP4lnY=; b=ky9CpUPU47G6GUX0BIje7EzJ/ntOeM73UZXhIwpoeyGviRskd/VkQIsgCQdbWfYSHA wWE31DHF63FaXtmgpLeifzIb/9R+pAq0NQVsgZCwiJvhWAP6DKOJx/Qfyt8c18q86epS wX5ufGJ3GT+l0wZ4XhmRMiL98M4qiAkFvxPNrjNlO8hLvXg1TmzNyX/6Iui95Y85WF2s AxjOWrpVcXjOY8YUxQ5iJG1cLaqh1P18RoM9r8rtwOIBFG0cwSdeQX+i7Fa7CvXLZ9sw NDeYYTlS6R+cR/Uj2tw5U+D8DOnz1WiiwwGa+/2gnS4CnEjJb7ecnmBSIqq/but5Vyyh 0yYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=flpHUM3jIkqI5icvoEOQORa60za63cCS1Ns8QwP4lnY=; b=ckNlRN3W6H5WWx+itME4H+XUtKQXk/YkL0ITnaxTguHbIh/hoUWnn19ueOXRVmGP54 kO+Hn4dT7o0URks8XKmnNq2eZyYPjBYGxwVbIz3KYEu/BnzaxQP8OuTIBekyzgMLj05t raDtwlooohGW+cx+XED/Y/KegsO2INMhQrfFxbnVV0rEuwPLjUrfsUMumqFMbFhi/8ZR J+JKYnu5rPdpIC3/YBCGhcBez36eC6ckZMM6or4Fd2pbA0oTEiCylbRQ6snP0seJdNr0 fNsBKRB/2uPohBwhppNrkwCuNXuAeX5nAZbh9jLxwG3flZQHQTdhvjXnTWsc5DoZakkP 0Rcw== X-Gm-Message-State: APjAAAUXIUm6SFfM4R4Fvix4dwCrRcZHNZd+PzzSTgDh2lFY/Gfa1xxA skg+lRvVWNYnVUeNkd/4e+Y= X-Received: by 2002:a37:a586:: with SMTP id o128mr21410644qke.147.1568299910876; Thu, 12 Sep 2019 07:51:50 -0700 (PDT) Received: from localhost.localdomain ([177.220.172.89]) by smtp.gmail.com with ESMTPSA id o124sm11916258qke.66.2019.09.12.07.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2019 07:51:50 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id 81A51C0DAD; Thu, 12 Sep 2019 11:51:47 -0300 (-03) Date: Thu, 12 Sep 2019 11:51:47 -0300 From: Marcelo Ricardo Leitner To: Mao Wenan Cc: vyasevich@gmail.com, nhorman@tuxdriver.com, davem@davemloft.net, linux-sctp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v2 net 1/3] sctp: change return type of sctp_get_port_local Message-ID: <20190912145147.GR3431@localhost.localdomain> References: <7a450679-40ca-8a84-4cba-7a16f22ea3c0@huawei.com> <20190912040219.67517-1-maowenan@huawei.com> <20190912040219.67517-2-maowenan@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190912040219.67517-2-maowenan@huawei.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 12, 2019 at 12:02:17PM +0800, Mao Wenan wrote: > 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 62208f12451f ("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. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") This Fixes tag is not needed. It's just a cleanup. Maybe Dave can remove it for us. Acked-by: Marcelo Ricardo Leitner Thanks. > Signed-off-by: Mao Wenan > --- > net/sctp/socket.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/net/sctp/socket.c b/net/sctp/socket.c > index 9d1f83b10c0a..5e1934c48709 100644 > --- a/net/sctp/socket.c > +++ b/net/sctp/socket.c > @@ -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, > @@ -7998,7 +7998,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); > @@ -8108,7 +8108,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) > > if (sctp_bind_addr_conflict(&ep2->base.bind_addr, > addr, sp2, sp)) { > - ret = (long)sk2; > + ret = 1; > goto fail_unlock; > } > } > @@ -8180,7 +8180,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); > } > > /* > -- > 2.20.1 >