Received: by 10.223.185.116 with SMTP id b49csp2466423wrg; Mon, 12 Feb 2018 10:00:23 -0800 (PST) X-Google-Smtp-Source: AH8x227bzagbH2tc03rt01XsNpVK0sQZSMKDiRIQ73oxnL2/c4K4f62mOM9svcEvn6P61P4q8HA1 X-Received: by 10.101.88.138 with SMTP id d10mr10205783pgu.52.1518458422936; Mon, 12 Feb 2018 10:00:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518458422; cv=none; d=google.com; s=arc-20160816; b=vOZ4e+qmzhyF+PuKzTFJMYDkbHbCJ4nt4SvFrsGhWzFEoRjgxrpAptz44/dQDs4lpO EI713YC83fJkkN3p2D9febZHAiA5usWqumNx+FPoyufGkAi52ZAaJe7reD+eCxF3dmHd QNkxdENM2SXF/QqA7gVzKvw5ny1JBL5movWuUVwLcb79SY4+BnPasm3teLhpLqiM+1VJ UH3WtzYIy8YMGmvfGfyk3Lrk62k5RBmuUiLt/C8nTvYstgS0AXH7rKf19Mp9rBQZDbO/ ks90/G47wKQSmd7qJ9Fumu862LRkbFnkoCLs7tip6YigA4QfjWHeLrnqv2MMn5z7ZWym TWfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=roOS0JgHvgZw6NJjZSxzG/nHDZ3inA5Kv+YBkh82mco=; b=HI6NbUaDOEkCcpPptaD2nx49ztru0+aOoWqczH/uxEi4ncZh+32SJzXlhEIi236UY0 66FTCzPzKynIm9reU2OsHL509wG6nzZNGMV0hq3GD7eQb/ugqmf6aW+0EVUKoEQagAE2 kaqdUbf+xcEu+Z5qeHw4hR5Q0wrY4xqSU7paA8pi1MNM1GHcRAkfBh664eHlvn1CzjYV Xhip/gq/IVv/YVQU436ZloP4SIr6E08+rz9LTHPA44BrM+lOR0CF4RVkUf7abJN5E9h6 RHQdzxWZyKrxm476+rQylp+Kuks8eZMECeFNLM+qbtUCSwsQPQtL2ecexJHuceeglGej FUJA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14-v6si6203282plj.519.2018.02.12.10.00.07; Mon, 12 Feb 2018 10:00:22 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932333AbeBLR7L (ORCPT + 99 others); Mon, 12 Feb 2018 12:59:11 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48542 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752532AbeBLR7J (ORCPT ); Mon, 12 Feb 2018 12:59:09 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A6ED7CBDB; Mon, 12 Feb 2018 17:59:08 +0000 (UTC) Received: from [10.43.17.120] (unknown [10.43.17.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF5D9106B250; Mon, 12 Feb 2018 17:59:06 +0000 (UTC) Subject: Re: [PATCH] net: make getname() functions return length rather than use int* parameter To: David Miller Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-decnet-user@lists.sourceforge.net, linux-wireless@vger.kernel.org, linux-rdma@vger.kernel.org, linux-sctp@vger.kernel.org, linux-nfs@vger.kernel.org, linux-x25@vger.kernel.org References: <20180212141518.3354-1-dvlasenk@redhat.com> <20180212.124738.870301786818646917.davem@davemloft.net> From: Denys Vlasenko Message-ID: <4f0c5a1d-f75d-4c54-8cdd-5660b2233252@redhat.com> Date: Mon, 12 Feb 2018 18:59:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180212.124738.870301786818646917.davem@davemloft.net> Content-Type: text/plain; charset=iso-8859-7; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 12 Feb 2018 17:59:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 12 Feb 2018 17:59:08 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dvlasenk@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/12/2018 06:47 PM, David Miller wrote: > From: Denys Vlasenko > Date: Mon, 12 Feb 2018 15:15:18 +0100 > >> Before: >> All these functions either return a negative error indicator, >> or store length of sockaddr into "int *socklen" parameter >> and return zero on success. >> >> "int *socklen" parameter is awkward. For example, if caller does not >> care, it still needs to provide on-stack storage for the value >> it does not need. >> >> None of the many FOO_getname() functions of various protocols >> ever used old value of *socklen. They always just overwrite it. >> >> This change drops this parameter, and makes all these functions, on success, >> return length of sockaddr. It's always >= 0 and can be differentiated >> from an error. >> >> Tests in callers are changed from "if (err)" to "if (err < 0)", where needed. >> >> rpc_sockname() lost "int buflen" parameter, since its only use was >> to be passed to kernel_getsockname() as &buflen and subsequently >> not used in any way. >> >> Userspace API is not changed. >> >> text data bss dec hex filename >> 30108430 2633624 873672 33615726 200ef6e vmlinux.before.o >> 30108109 2633612 873672 33615393 200ee21 vmlinux.o >> >> Signed-off-by: Denys Vlasenko > > Please do an allmodconfig build, there are still some conversions you > missed: > > security/tomoyo/network.c: In function ?tomoyo_socket_listen_permission?: > security/tomoyo/network.c:658:19: warning: passing argument 3 of ?sock->ops->getname? makes integer from pointer without a cast [-Wint-conversion] > &addr, &addr_len, 0); > ^ > security/tomoyo/network.c:658:19: note: expected ?int? but argument is of type ?int *? > security/tomoyo/network.c:657:21: error: too many arguments to function ?sock->ops->getname? > const int error = sock->ops->getname(sock, (struct sockaddr *) > ^~~~ > fs/dlm/lowcomms.c: In function ?lowcomms_error_report?: > fs/dlm/lowcomms.c:495:6: error: too many arguments to function ?kernel_getpeername? > kernel_getpeername(con->sock, (struct sockaddr *)&saddr, &buflen)) { > ^~~~~~~~~~~~~~~~~~ > fs/dlm/lowcomms.c: In function ?tcp_accept_from_sock?: > fs/dlm/lowcomms.c:761:7: warning: passing argument 3 of ?newsock->ops->getname? makes integer from pointer without a cast [-Wint-conversion] > &len, 2)) { > ^ > fs/dlm/lowcomms.c:761:7: note: expected ?int? but argument is of type ?int *? > fs/dlm/lowcomms.c:760:6: error: too many arguments to function ?newsock->ops->getname? > if (newsock->ops->getname(newsock, (struct sockaddr *)&peeraddr, > ^~~~~~~ Sorry. Will send updated patch.