From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 737A4C433DB for ; Wed, 17 Mar 2021 16:17:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2EAFA64F4D for ; Wed, 17 Mar 2021 16:17:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232513AbhCQQQj (ORCPT ); Wed, 17 Mar 2021 12:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232405AbhCQQQY (ORCPT ); Wed, 17 Mar 2021 12:16:24 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA5DEC06174A; Wed, 17 Mar 2021 09:16:23 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id c131so41067674ybf.7; Wed, 17 Mar 2021 09:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pIpmj0iUFUslcZM65CcWWuddq7UeQyGpZ/kaKvhwHeQ=; b=gpqDMxpSK8BK9uRYHO1Sn6gNnn+TvoFykR3BvxJt37V6xTNoZDItmkcex5eiLW11AY 5efknekSUsz5t2Y7pGkMxzSY9OFUWW26kZxovOJ/7ndrWxhstzm1Gz1pPcgCpX3q4i4k xhuBkq6tG9WRAuOmYhGyh99wpTZk4K7RuDvj5ADQi3tOLY+vwdpg8nbrU6oasXfkQrxD f/HGTgmU7VoYL3HwvfmyiEXxYp1rDMNEct6TEuRAiJmjQmt++Icg3g98hpj2E7jkzo/R i6qLf14ewVxQUkQ3YhBMpqk0M3v4Q+/U3XL+F4AxKRF65ggDx6J8Nb61kn2LsCkW1O02 4NUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=pIpmj0iUFUslcZM65CcWWuddq7UeQyGpZ/kaKvhwHeQ=; b=THYbJLQuyPpuskkxQNT05E0XtAfwe70BJ5B/PO+FlSfmmhK9fR/vmhVdVLbesHAo36 knaLwUuJFrCjzha8DQgCfx5LEyUaohyXDKGGITlSE9DA+cADFpsd48lyNBtWSs/bgp3J 3ItAjm9PcU6TDoldmNz6/I1myUkp76XpZxsVEjkSFZ3YeuwYNqJRo4hJiHN/TAsRlbyI VNkQiJL3BPnzBdpkwD6q2xGzbQ2SIvslbTCQOx9W7wxwwuOEDQH7OQTUHXJPWaU3Y48D ybqFDco+pPeEhovG8C7IiGGKvhwQFZu2J4Ubmyfv3NvL2RubLxCf9m0bCqEbvmBouUIe j3kQ== X-Gm-Message-State: AOAM531SMevTmf42TRAIm5C7mvedm5K1LDgA3d6J3uqoE6fR+9U8fh9u qhxBIdJntK1OdA2jp1MhDzI5Lcvyyxg= X-Google-Smtp-Source: ABdhPJx3NVYL4eQ0A3J7BdfBAKLuTDC2vodxhHAN7TCA/479BuIIzg98gC8ALCJEsaoPuzlx+BIpOA== X-Received: by 2002:a9d:68c1:: with SMTP id i1mr3662420oto.169.1615993362373; Wed, 17 Mar 2021 08:02:42 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id k9sm8748211ots.24.2021.03.17.08.02.40 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Mar 2021 08:02:41 -0700 (PDT) Sender: Guenter Roeck Date: Wed, 17 Mar 2021 08:02:40 -0700 From: Guenter Roeck To: Menglong Dong Cc: Andy Shevchenko , Jakub Kicinski , "davem@davemloft.net" , "axboe@kernel.dk" , "viro@zeniv.linux.org.uk" , "herbert@gondor.apana.org.au" , "dong.menglong@zte.com.cn" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" Subject: Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_* Message-ID: <20210317150240.GA159538@roeck-us.net> References: <20210310015135.293794-1-dong.menglong@zte.com.cn> <20210316224820.GA225411@roeck-us.net> <20210317013758.GA134033@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 17, 2021 at 09:53:23PM +0800, Menglong Dong wrote: > On Wed, Mar 17, 2021 at 5:36 PM Andy Shevchenko > wrote: > > > ... > > > > The problematic code is negation of the flags when it's done in > > operations like &. > > It maybe fixed by swapping positions of the arguments, i.e. ~(FOO | > > BAR) & flags. > > > > All this is a beast called "integer promotions" in the C standard. > > > > The best is to try to get flags to be unsigned. By how invasive it may be? > > Seems that the inconsistent usages of 'msg_flags' is a lot, for example the > 'recvmsg()' in 'struct proto' and 'recvmsg()' in 'struct proto_ops': > > int (*recvmsg)(struct sock *sk, struct msghdr *msg, > size_t len, int noblock, int flags, > int *addr_len); > > This function prototype is used in many places, It's not easy to fix them. Also, flags is used in several other functions, not just recvmsg. > This patch is already reverted, and I think maybe > I can resend it after I fix these 'int' flags. I would suggest to consult with Dave on that. While much of the conversion could be handled automatically with coccinelle, it touches a lot of files. I don't think that is worth the effort (or risk). Guenter