Received: by 10.213.65.68 with SMTP id h4csp1766083imn; Sun, 1 Apr 2018 14:29:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx48WBj5HwPNKfFNynCVAbsw+NU5htwRVwTg1HQJuM45IX8aKPSmy/aue7Bct/ehnw9edgUXa X-Received: by 2002:a17:902:5305:: with SMTP id b5-v6mr2007602pli.326.1522618180683; Sun, 01 Apr 2018 14:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522618180; cv=none; d=google.com; s=arc-20160816; b=CKthDDHVQNa+ywolptbTmbD64nQ6dm7A8WcINCXSW6qQzUi7FWMCNptnyHvYlxuQvG dImWcsPtNIrg6aJVvVayTVcKx5MepBhdZ64Zqy0RY62mytxlyJAp9Y1nqEwpkYR1vlHJ grOg19rbM8a2zrojhdT68IpDrU8WtUTjSdB2eTt2sYkKIAqSUFW9YXek5LndWqvS+Dj9 8e9I3H9IDpudTb4vLgD1ZSLO2w34pYLC0JR8wEz0zAYF5cJ4n1Z7R+YICqPmhNO97K6f Iz7ZX74IrBlEHTTJRCRirmYspAxGmL45nweza++TdJo7RI+KMRIVYvmbWFcbIcMhT21F BUpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=ZgMjaV68EFa1BO5xbgvciJZTXZt+PoduvHUvp7V3YAc=; b=bFAh5t00B7QCJRU0SpqKlcFoWZOvLeoPezIkIlNtHh67/dbbSKN8ZqzJxEsWsLvmI0 TGfroOO+cqFQ4HN9HbwFkgSCfs9OK6O6iNAfV6iS4S20L56v+AQ9wE5oY4OL5IbR5fmP jIG26L5Y1n/69nnVQSRyOhRoVQfXJdsbaWCquUxOEMxFE4+mwZ38OfLg9HteGKExEray xNhsxRJwXKK5qTLWVtcxl8ur+VqOOHy8mq+u65YGO0yukH/58Cpse/Dr9JgLK0nRJ7VR YBkVMHmiajghw3VTXZ+CvMW2C8l/b9hNLYPendHZQgznL20MTujEvfEZTcP1c3sE7tg+ QlGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CbBIDGnn; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o69si9890107pfi.322.2018.04.01.14.29.26; Sun, 01 Apr 2018 14:29:40 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CbBIDGnn; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753947AbeDAV2W (ORCPT + 99 others); Sun, 1 Apr 2018 17:28:22 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:44892 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbeDAV2U (ORCPT ); Sun, 1 Apr 2018 17:28:20 -0400 Received: by mail-wr0-f172.google.com with SMTP id u46so11927611wrc.11 for ; Sun, 01 Apr 2018 14:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=ZgMjaV68EFa1BO5xbgvciJZTXZt+PoduvHUvp7V3YAc=; b=CbBIDGnnwKnZRZDUGjDqR8UM4mxtWmHIpPH0rn+v1OfzSdakX+2KAvC3qO6IFmg65y KXa2OBjY3KfIYVqEPqJgk376Sw0du3t2IA8jwO2CneDdxZVYHHP+axL9UxM6tzxtW6zf 67KBGxG6d4wbN0Z0NHbHBokSWd4kAhSYvITogDnY/QuWN3BFORVlEhMyesuyFC58yY3Q 6k+ELZPX9FzVR0pkhINZw/6Z8pJNGLrZ+w+iBkiLwE2zg0G/gGwdAdtCxyw9uYUuIrnW AYCHSehJGM2kv73Dj26Z3LohvGjpt6SX0GHNo/+psGTlHxsz2gJly58OMbX3mUnm2QKm RRaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=ZgMjaV68EFa1BO5xbgvciJZTXZt+PoduvHUvp7V3YAc=; b=daVuN+t2SwGUeaNmpGcUr1t6AUiaaGZMMT6bkPtFbW+5ApGsl92zk4ivqEmVMAQXs9 ytDu5gSn7o9gQrDUSbQPvkQ/CKieOLv13i3nhw+oylBbiO7CK52jmN0r7SyElKmzw0iJ g69NHw/1c1b12QSIDdlscBjpgBXSXn9FSsRVGxCrufpmrhTKyeIXqxlKgPboL1Gtki53 aSq3RQa6iXJMcpGbtS7iTPhcsW7IBkPLIYkXSA8ELViPffx6Z/XNwALKNNXG6svfTroc +UXEeF9PsOo7DSZuELJ/IKQ+n+yYKW3rQBU31taoCcdV/BAN84WejKjonV2rb/oTa7C0 fFVg== X-Gm-Message-State: AElRT7HEadXDrR98XDCpWpNH24E38k6LKUdGv8dSnA9XVcVzphtgIVL1 qw1s+Tb9eDhOY9IClKnSaQ== X-Received: by 10.223.208.133 with SMTP id y5mr4715766wrh.216.1522618099428; Sun, 01 Apr 2018 14:28:19 -0700 (PDT) Received: from avx2 (nat4-minsk-pool-46-53-177-92.telecom.by. [46.53.177.92]) by smtp.gmail.com with ESMTPSA id 55sm28236073wrw.52.2018.04.01.14.28.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Apr 2018 14:28:18 -0700 (PDT) Date: Mon, 2 Apr 2018 00:28:16 +0300 From: Alexey Dobriyan To: dhowells@redhat.com Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 34/45] C++: Fix up use of LIST_POISON* Message-ID: <20180401212816.GA25507@avx2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > - entry->next = LIST_POISON1; > - entry->prev = LIST_POISON2; > + entry->next = static_cast(LIST_POISON1); > + entry->prev = static_cast(LIST_POISON2); There is a better way ;-) --- a/include/linux/poison.h +++ b/include/linux/poison.h @@ -2,6 +2,22 @@ #ifndef _LINUX_POISON_H #define _LINUX_POISON_H +class POISON { + unsigned long p; + +public: + explicit POISON(unsigned long val) + : p{val} + { + } + + template + operator T*() const + { + return p; + } +}; + /********** include/linux/list.h **********/ /* @@ -20,15 +36,15 @@ * under normal circumstances, used to verify that nobody uses * non-initialized list entries. */ -#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA) -#define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA) +#define LIST_POISON1 POISON{0x100UL + POISON_POINTER_DELTA} +#define LIST_POISON2 POISON{0x200UL + POISON_POINTER_DELTA} /********** include/linux/timer.h **********/ /* * Magic number "tsta" to indicate a static timer initializer * for the object debugging code. */ -#define TIMER_ENTRY_STATIC ((void *) 0x300 + POISON_POINTER_DELTA) +#define TIMER_ENTRY_STATIC POISON{0x300UL + POISON_POINTER_DELTA} /********** mm/debug-pagealloc.c **********/ #ifdef CONFIG_PAGE_POISONING_ZERO @@ -39,7 +55,7 @@ /********** mm/page_alloc.c ************/ -#define TAIL_MAPPING ((void *) 0x400 + POISON_POINTER_DELTA) +#define TAIL_MAPPING POISON{0x400UL + POISON_POINTER_DELTA} /********** mm/slab.c **********/ /* @@ -81,7 +97,7 @@ /********** kernel/mutexes **********/ #define MUTEX_DEBUG_INIT 0x11 #define MUTEX_DEBUG_FREE 0x22 -#define MUTEX_POISON_WW_CTX ((void *) 0x500 + POISON_POINTER_DELTA) +#define MUTEX_POISON_WW_CTX POISON{0x500UL + POISON_POINTER_DELTA} /********** lib/flex_array.c **********/ #define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */