Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp331623ybg; Wed, 3 Jun 2020 01:52:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc3IBnpzMdjeRhHDisML5Z6fkpd93VS0zpy7msj//1YaEFqq4Ig6AgtmpNNhZV+assjP+r X-Received: by 2002:a17:906:4c96:: with SMTP id q22mr17804323eju.263.1591174323766; Wed, 03 Jun 2020 01:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591174323; cv=none; d=google.com; s=arc-20160816; b=h+6ifSXk34psTAgTVcBIlsJw8+OqFsW5seiet5kbix4cjBWMoO3O18dSwerWp2ODWS jsSkrAonMh6fX2Jd7Mxx8uBVxSisFgjIxnGHkTu5p8nnSJMdPyZ6aqQDIJsvz/h3GGnu qFhtPFwa29IHJGcl6Ce7BSb7oB/hEqonck+4/7wroKvFQbUIa5szkvCUFzAMlqtRFaRT 65ytCBR+Slhqal0IFo0ub3bSoeQJDxscbfipwl+dlMpYnHUZKzd+uZze+yDJ4H2bmg1e paM2SV2ui+RocClID4LjT7Ye9sra63cAxiGWEywWe9cDzq0oEl7BhzdhV0rAii/wd5KY 7NXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8aGny4PzdL22O010eFSHqSioLRZBiFGjcHa443y84BE=; b=AxkEBzEqHsAgV7m/XQg0prmZ2wcq6UGCxPv06ddoE0Y0sLuQTKEkJhW0V1BeUgbIUa nKVIQ46Ya8E8nH7cVB4ImNQUajUM25aZFzzLeJtiloc+JreODu+e2bWs/fAITTa6Vamz Cn1hU3MiRqEifhkL8m0eBRuYpODRwNfiFz/CMEWTMQOLOhbt28dyUVhU5gf8aNkqzFoH X5Nqf54Ij9prB+tVrufnoKqKqFTKlEHq01XjIafQw3GpHXfjfw7KcTqpufDycfdpUE7+ pZAOzhc+k8uOKeT0Dtg1ndSd32/Izl6Mvn2WJ2zr/CTdGglBOt9Z568ae4KTUvTU/EBZ j73Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Zj7L/J7k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id cz28si690230edb.384.2020.06.03.01.51.41; Wed, 03 Jun 2020 01:52:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Zj7L/J7k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726150AbgFCItz (ORCPT + 99 others); Wed, 3 Jun 2020 04:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgFCIty (ORCPT ); Wed, 3 Jun 2020 04:49:54 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 947DEC05BD43; Wed, 3 Jun 2020 01:49:54 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id u5so1310649pgn.5; Wed, 03 Jun 2020 01:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8aGny4PzdL22O010eFSHqSioLRZBiFGjcHa443y84BE=; b=Zj7L/J7k6EChQiFbOMJ1ElY9JLYSP0fP+tI/xor871+oem5sGl8vz28txEyB+KDijt YolYvP+ODw6t/Lzz7PoEV2H6iAcwskLJ1wqFW71qSZjzcsJzyRJHCo1Bojk7cTiqg0Vw 9LuWn9ZnAs4NTCcIoQNxy86dvYLscLVeMGfHYdCbIklfcXurzVvS0ftoooZhOXGSE4F7 66vfNIZFIwRKgLXg9vTyEcTNXWENxz+EBn7SM4oNsG87cwbhILrv8yDd2G1UbPzy8xKc e1PHrX9jzVZQ4IvBMKgOXVCHbZ62xQsIq/Wmo230XDgE32H+vkR2cT/sJGeqJUJe5Xo0 +woQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8aGny4PzdL22O010eFSHqSioLRZBiFGjcHa443y84BE=; b=NdZEQQy9Ed5o7gdPfzR5vpEXJ2rLhPSfpel6acGuU+iW33sGBtRZj4QMeXdvch4f+B gVg2iq8kp98hlForWjBmQQ1K6WVyj/cmFZej7JwDS47tSD9n1CPBfhbsNPs18GSDkWiF Y/5vNnk0Aiz2oIpqrca5joY3mJ9O0nf2Q9CRR8Q9U/y0O8dsxTZgs0NcC+Eeit7egQao HdgeXt09FHopeqzb35+fPnWY/5DFTJudVLVHu/c1ZFTDWdnrGmwnipNL78iLe+0s514r bNg8kf0yQEWOjzNOXiu/eMugysJhZgwmvk6pHOV/pCFgZsxyiuW7LDHR8V3HsFZI1fZe GVlg== X-Gm-Message-State: AOAM531dUQt5NkHBOHPxaXB0cD/9ixuet32qeUQm0Tz24QzA+580rFiW LekU761JhTJ2uZzB6SOGf11LmHkc6ZuybgArtTY= X-Received: by 2002:a62:148f:: with SMTP id 137mr28392591pfu.130.1591174194053; Wed, 03 Jun 2020 01:49:54 -0700 (PDT) MIME-Version: 1.0 References: <20200531223716.GA20752@rikard> <20200601083330.GB1634618@smile.fi.intel.com> <20200602190136.GA913@rikard> In-Reply-To: <20200602190136.GA913@rikard> From: Andy Shevchenko Date: Wed, 3 Jun 2020 11:49:37 +0300 Message-ID: Subject: Re: [PATCH v7 1/4] bitops: Introduce the the for_each_set_clump macro To: Rikard Falkeborn Cc: Emil Velikov , Syed Nayyar Waris , Masahiro Yamada , Kees Cook , Linus Walleij , Andrew Morton , William Breathitt Gray , Arnd Bergmann , Linux-Arch , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 2, 2020 at 10:01 PM Rikard Falkeborn wrote: > On Mon, Jun 01, 2020 at 11:33:30AM +0300, Andy Shevchenko wrote: > > On Mon, Jun 01, 2020 at 12:37:16AM +0200, Rikard Falkeborn wrote: > > > On Sun, May 31, 2020 at 02:00:45PM +0300, Andy Shevchenko wrote: ... > > > If we cast to int, we don't need to worry about the signedness. If > > > someone enters a value that can't be cast to int, there will still > > > be a compiler warning about shift out of range. > > > > If the argument unsigned long long will it be the warning (it should not)? > > No, there should be no warning there. > > The inputs to GENMASK() needs to be between 0 and 31 (or 63 depending on the > size of unsigned long). For any other values, there will be undefined behaviour, > since the operands to the shifts in __GENMASK will be too large (or negative). What I'm implying here that argument may be not constant, and compiler can't know their values at hand. So, in the following snippet foo(unsigned long long x) { u32 y; y = GENMASK(x, 0); } when you cast x to int wouldn't be a warning of possible value reduction (even if we know that it won't be higher than 63/31)? -- With Best Regards, Andy Shevchenko