Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp825352ybg; Wed, 3 Jun 2020 14:56:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzLvWztLlDWTFg+Yp1N014YaTjLJG3Z91Cs5aDtzQ0gu8E6hd9SF3snijHbUgcfm/alBq9 X-Received: by 2002:a05:6402:1243:: with SMTP id l3mr1553676edw.64.1591221408091; Wed, 03 Jun 2020 14:56:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591221408; cv=none; d=google.com; s=arc-20160816; b=rU/lgVUWw2hEJIGeV+qRsiaClTEGa0EoTC7p1YQX+SvxkHMXxMFyTbYtifjce2hW1J KrcKHZLhtwUeMS2VNdWPrNUmDbhFWESbjSIWu3aA8UkTWCGnkNYfBseWTgq6pVBFgOj5 kn0c9wNiYaUKpAyDYVACAtZ+PU3YjyjLBBhNmtQKKdZG2vPa6R7/PttN6OuNj1WLsPNT 9KN8XSAGHsoqGjvkCyXtZSfhjZFbSb6/Atgs6nBCnGDHpB10hikj9dH11Rig7hjuqCYq AuwIY6XQQ4+eJ7QI4kK7bVg3BOvBi/s+i1QZitg6C3/tG+9SyDBU9BOBIFQ/ZBymh4Pu XYWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=BDJiR6Y3Jnskb29DRc28eXar01RDhTmGwSHZkvP44kA=; b=jZeFGpN0S6tA7l1xjZkqFuskizgi2Pd4ve7RZOeVseKda1OORRE1o1M62bnOBGM6T2 b2LVscoCplHjluKoZM0zFcdaI4pU70QfMDPuKEFzmBq1O+EiztPTk7qMoA5XkGVwq6gg RHrKDmmFIZIlpFcptnsjpQC9A4wZ8hNilT/QVOT9+y5tvdn8O7bmIq6OOKhQiqbqR4Ee s1T7vtDNxyZZcDeC8izGJFUhWcqgCGz3JmRq4OaKtArahhSYWPcirKYyaZWdSi95XcLv HNAtf3QCHNi1pwg+JSaanX/PRCvQXzmpMCucFzD30Az+tQXDyBjAxvh/EVNxfDHX5hZ3 7z0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E5ZBZ3n7; 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 w17si431003edt.490.2020.06.03.14.56.24; Wed, 03 Jun 2020 14:56:48 -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=E5ZBZ3n7; 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 S1726479AbgFCVxU (ORCPT + 99 others); Wed, 3 Jun 2020 17:53:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbgFCVxU (ORCPT ); Wed, 3 Jun 2020 17:53:20 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33DDC08C5C0; Wed, 3 Jun 2020 14:53:19 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id n23so4712516ljh.7; Wed, 03 Jun 2020 14:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BDJiR6Y3Jnskb29DRc28eXar01RDhTmGwSHZkvP44kA=; b=E5ZBZ3n7cEMtIB4IeleRFjVYmNfFTf9rUXsSqGXfeBFiYWDcYBq0a7EeRmerSEGp/1 GWT2NQj9LRYpLKjKtpFMDgcxrgQlLG7gVvZZgggbxchpKQxy9VICNlB2mNE0SQVvYbjw qYUA1UWxONPui2ACGsC42l6TIv69BwcAD1fsHItf0wIEellKB/XGGFy08HiO+nkn/yjW jPwMIFU9nykKsdWuLW62q4eNZm1JWGsp1F4XO2LtBF7FGzNoS+0PVNBmIMLptCaxEIos bHiPjwg/5j5qe9G8ZeClSyLDQII2JsbK+61A4MdChR3tNDe0/8n/J72UjBSogQCfKddd oXIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BDJiR6Y3Jnskb29DRc28eXar01RDhTmGwSHZkvP44kA=; b=b9nGjxrTevBKSjpDJEl3HrTKpWg77dNhCIvqNviquxxjREcexcGI8QcdBEN1DINLer iqNfcKTpiXOM56FeGTONmS8jk+yKHGe4B/s6ttPaFMpVfX3NO3J5+TzViEdc2Hc6wWbk W0cn45nHz3rUAahVu9QXdg8GzjPvMnZJlDxmbnYiU5Z1MwxmZG9r/Sg9QjPaK//hwjpg G1Ad8PfTL12rqNs6UwcDSGuwUlIH2sieip9JYdXGh81dh9tZCdIA/CdH7aFZcRiXev3s f0oPELX7eueR7ObunrI8jZy1zpDqMFpkmSeVqoXlU2N29653vrwk8WoxUHAcwvN85UuC cgJQ== X-Gm-Message-State: AOAM531vG1YBZ8PUFVN4d9Mk5SPTMmeQYsWvO96RUZGr7vCgRSg6Fbpx /n1T88GC2/u/jwPsV6zY5TQ= X-Received: by 2002:a05:651c:38e:: with SMTP id e14mr615711ljp.452.1591221198109; Wed, 03 Jun 2020 14:53:18 -0700 (PDT) Received: from rikard (h-158-174-22-22.NA.cust.bahnhof.se. [158.174.22.22]) by smtp.gmail.com with ESMTPSA id y3sm499413ljk.39.2020.06.03.14.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 14:53:17 -0700 (PDT) From: Rikard Falkeborn X-Google-Original-From: Rikard Falkeborn Date: Wed, 3 Jun 2020 23:53:14 +0200 To: Andy Shevchenko Cc: Rikard Falkeborn , Emil Velikov , Syed Nayyar Waris , Masahiro Yamada , Kees Cook , Linus Walleij , Andrew Morton , William Breathitt Gray , Arnd Bergmann , Linux-Arch , Linux Kernel Mailing List Subject: Re: [PATCH v7 1/4] bitops: Introduce the the for_each_set_clump macro Message-ID: <20200603215314.GA916134@rikard> References: <20200531223716.GA20752@rikard> <20200601083330.GB1634618@smile.fi.intel.com> <20200602190136.GA913@rikard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 03, 2020 at 11:49:37AM +0300, Andy Shevchenko wrote: > 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)? Got it, no I was unable to trigger any warnings like that (but I still can't reproduce to original warning, so take that with a grain of salt). I'd be very surprised if compilers warned for explicit casts but I'll send a proper patch soon to let the build robot try it. Rikard > > -- > With Best Regards, > Andy Shevchenko