Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp822090ybt; Wed, 17 Jun 2020 15:07:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+S3Cv3e38nBtPrd9sKyLUv5GfQZ6841J2ct6R76h6qbFzVN3l8VUAnoIt0eMWpjnWa9XF X-Received: by 2002:a05:6402:1761:: with SMTP id da1mr1253565edb.68.1592431627112; Wed, 17 Jun 2020 15:07:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592431627; cv=none; d=google.com; s=arc-20160816; b=C3IUB1YeHTd34sxo04RVFlH60VMGxWfHRGgeZIadX4hiCx4gEPlpoRRBoyN+jbbq3z o5/wni2NinDcipqYh/Br0lTGEGaTU9vAjPwrZ+ECQ+AB8vdG7TyVVPYJuAfX8tNS1RXK qJUrY1QEWi3ZQNG9URp6C8oDkwuhnlP6BUSncgCV7ze29G/uRVkrT/Z2TAYSwPTKp/Cf qgpRvQolsvV6UCdo9Gf7kett06Ke1Ff9Oj/Cnc7IYBSUS7bamN2MQDRMsVRIV1S/Sr3C Z9vh2C7Cjx9WmUJAaDjBo5u/fEEXWb6reeJ9AgzySvUl53RSsfjFDA10R4niux+nUcDE Y6xQ== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=S4GQU+Ak6vDeugqH+L9eb4VI0/sz8RT+gMEBBpPLtPc=; b=hJa4KfjefWKwilNXAG3mwib0qusz2HKBkcik9zCjNVwlntRIdhVu8XWj7KroH2XXIT C5aANWrjIpJA7VIR2LPi3LRk1Xk4WJhh/vzGERGFCylGJOx2JD009zzjdiKxidQRVJ57 lfwSrxM7NSNxg9OGhfj6W31aOgIPHNi8sYE14t5jBk2gRX9psowkWVfKELmeN32rh6Rn p4AL3nXhbeHmjwuJnqDei4ISLeQVy4tYByOfWksITLYfiAOPFZ4vNFIhIFMAK7VcDXTU aZFMODrelyyKM3aQFe2mhvnWE93spYxSA0JKtBuQw7Y+46cmmbQZ7Dmy9lHe9ktPFR+Y WShg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=seuRBQQg; 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 k6si710486ejr.212.2020.06.17.15.06.43; Wed, 17 Jun 2020 15:07:07 -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=seuRBQQg; 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 S1726986AbgFQWCd (ORCPT + 99 others); Wed, 17 Jun 2020 18:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbgFQWCd (ORCPT ); Wed, 17 Jun 2020 18:02:33 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0296C06174E for ; Wed, 17 Jun 2020 15:02:32 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id y13so4264031eju.2 for ; Wed, 17 Jun 2020 15:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=S4GQU+Ak6vDeugqH+L9eb4VI0/sz8RT+gMEBBpPLtPc=; b=seuRBQQg3oh6kPnVvkEqvGbnbS+7+UJwfKkgBUO0KiZDLOMu4MUGmqGcZaQl31zaCK /PiPTLnZsBb306sehvPFLhX4ZaRl6iP/qWk5B1VnRFLbbby6ejt0I2yaEwOhCeIJbTT3 KC0PGnDugKOFnQIBpKZIiPoA1jB7Hb2BxmausqwezphnfAf/WpcWtjoRplHr2g31D1Pb SxwYEQXFMGe1AXsmnEAI05FULpBZ5jDP3N/L26eYfPTwYy05VXGo9EMNTOu+hQiCU89x U/l6xmVHbdQPkczfFvScC6sYtbY+c5YEku1TWjcJm4s1H3D2ooGzGooSvQdYj02omibM 3TdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=S4GQU+Ak6vDeugqH+L9eb4VI0/sz8RT+gMEBBpPLtPc=; b=ZFBxo3c4W+HdBKj0p/jD6B8rVArMsGKs5t8FnZ2dbGDabYHQqvWAWj7mzSagcIrn3o O+dvF+1ynX7ZGSsh5RV/CohC654MTSuz4HXWExZ/5as1f3WIlOgCcBxX8WFU6AxDLtPq mOhxY9yhukbxTkSGjwDTx9uSoIzl9okc5P3ExcdxEH2i8jW18ICWzyr3WC7Sya55rTQd 3G2yZBLzGw8DOUp2/mjEoWa1CLOt++bFtXM/aImk8rGOhb4cBlQ+6EnMzbIIewAkHwBh IsUkD+4k+m4YwNqsb19VJBD1UXz4UX2ejFwEqbV802/6qxVPEzg8CysMB+87eE+IXmZb B3Dg== X-Gm-Message-State: AOAM531qNmJ+VUwnPT2FBCcH9fn/H38ctH3Pi42GraB6hr1w9mDJ2Q0L ilB5UtsWDW74zjI1PJFqm/w20P+U X-Received: by 2002:a17:906:3745:: with SMTP id e5mr1170455ejc.19.1592431351484; Wed, 17 Jun 2020 15:02:31 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:4d22:7f40:3ec9:4c8f]) by smtp.gmail.com with ESMTPSA id n35sm610361edc.11.2020.06.17.15.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 15:02:30 -0700 (PDT) From: Luc Van Oostenryck To: Linus Torvalds Cc: Miguel Ojeda , linux-kernel@vger.kernel.org, Luc Van Oostenryck Subject: [PATCH] sparse: use identifiers to define address spaces Date: Thu, 18 Jun 2020 00:02:26 +0200 Message-Id: <20200617220226.88948-1-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, address spaces in warnings are displayed as '' with 'X' replaced with the address space's number. But since v0.6.0-rc1 (late December 2018), Sparse allows to define the address spaces using an identifier instead of a number. This identifier is then directly used in the warnings. So, use the identifiers '__user', '__iomem', '__percpu' & '__rcu' for the corresponding address spaces. The default address space, __kernel, being not displayed in warnings, stays defined as '0'. With this change, warnings used to be displayed as: cast removes address space '' of expression ... void [noderef] * will now be displayed as: cast removes address space '__user' of expression ... void [noderef] __iomem * Signed-off-by: Luc Van Oostenryck --- include/linux/compiler_types.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 21aed0981edf..e368384445b6 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -5,20 +5,20 @@ #ifndef __ASSEMBLY__ #ifdef __CHECKER__ -# define __user __attribute__((noderef, address_space(1))) # define __kernel __attribute__((address_space(0))) +# define __user __attribute__((noderef, address_space(__user))) # define __safe __attribute__((safe)) # define __force __attribute__((force)) # define __nocast __attribute__((nocast)) -# define __iomem __attribute__((noderef, address_space(2))) +# define __iomem __attribute__((noderef, address_space(__iomem))) # define __must_hold(x) __attribute__((context(x,1,1))) # define __acquires(x) __attribute__((context(x,0,1))) # define __releases(x) __attribute__((context(x,1,0))) # define __acquire(x) __context__(x,1) # define __release(x) __context__(x,-1) # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) -# define __percpu __attribute__((noderef, address_space(3))) -# define __rcu __attribute__((noderef, address_space(4))) +# define __percpu __attribute__((noderef, address_space(__percpu))) +# define __rcu __attribute__((noderef, address_space(__rcu))) # define __private __attribute__((noderef)) extern void __chk_user_ptr(const volatile void __user *); extern void __chk_io_ptr(const volatile void __iomem *); -- 2.27.0