Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp33637pxf; Wed, 17 Mar 2021 14:33:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXWA7vn++MGXmFX82CeEnYoa+14fPOtJeJAFY5X4QFhVvibhSP+j3980WGD+83rm477ph+ X-Received: by 2002:a17:906:4ada:: with SMTP id u26mr37944161ejt.129.1616016824040; Wed, 17 Mar 2021 14:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616016824; cv=none; d=google.com; s=arc-20160816; b=ToGvWF8EMg6lWgt1UawTj7Tmg+ZSCHdyJIubAOETa8nA7IHyJbnXpZOtYKsZXb79OJ l0DV+usZTLX4rOc3+Jtrc0SUO9CkaVDDxF0AHzBFGzaff0Wz4sVqhmdfnRPmSQ/03o4m loyl+gHvYPfru9USNMvtTT+lii+NqF4nz8GiYzVpAcESi54Tf71CHq6w+E1D1BItcNZx AMwzM0cUDBQoVA0gR480ZLe+VO4X42O+Dny+5Vwz+U3KPMxnWtAJ/mHESOBd1misvCBn a/teRsUv+8AZXA4eqNheMMziJ0DLY6dNioibWwZTfSPJuiA7oyM/P3ludFMs5Q0uBszl zLVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=AzTEWxmNmU3hbpnceWVIAg+pttmNO9Y+1+/03Y2x+fE=; b=K7qqN7MVr9e3SXZaSH4ziQ8JmRJ4OjVdueqTZV2QfzK03ILQd3uh6o0yihAfcmacMg Cf7GKvnd5oqhCWrwSlvaeXovJIh7D8KfQTZyd3HWysVJgfYL0ZP8vbE0rQCzSpvJgOxs ZihZ53rhAoOPg3urC8XXpQJ+Kg1ZoK0XZUJKMWvubeVtXao0cq2F/ZatIuQ060MqbObu Gu5o/LeFOdWHJo0pcJ8ZK7AQRboV4/O+qMqHkMW1brf7zyIupCKXwXDU/Kzj7fMElOeE 38zPjlU4WNtMUvU/10yxHd7fxifpkvL0osZVZtrCXTinr9s4xlgB4ZFeCSEaWwZPzK3R bsAg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si27179eji.445.2021.03.17.14.33.21; Wed, 17 Mar 2021 14:33:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231311AbhCQRgt (ORCPT + 99 others); Wed, 17 Mar 2021 13:36:49 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:37721 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbhCQRgr (ORCPT ); Wed, 17 Mar 2021 13:36:47 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4F0y583vFpzB09Zd; Wed, 17 Mar 2021 18:36:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id v-2_sLTpHPTF; Wed, 17 Mar 2021 18:36:44 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4F0y582RpmzB09Zb; Wed, 17 Mar 2021 18:36:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 213F28B866; Wed, 17 Mar 2021 18:36:46 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ARYtUs8FK9Ly; Wed, 17 Mar 2021 18:36:46 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5F7D28B865; Wed, 17 Mar 2021 18:36:45 +0100 (CET) Subject: Re: [PATCH mm] kfence: fix printk format for ptrdiff_t To: David Laight , Segher Boessenkool Cc: Alexander Potapenko , Marco Elver , Andrew Morton , Dmitriy Vyukov , Andrey Konovalov , Jann Horn , LKML , Linux Memory Management List , kasan-dev References: <20210303121157.3430807-1-elver@google.com> <20210316153320.GF16691@gate.crashing.org> <3f624e5b-567d-70f9-322f-e721b2df508b@csgroup.eu> <6d4b370dc76543f2ba8ad7c6dcdfc7af@AcuMS.aculab.com> From: Christophe Leroy Message-ID: <001a139e-d4fa-2fd7-348f-173392210dfd@csgroup.eu> Date: Wed, 17 Mar 2021 18:35:18 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <6d4b370dc76543f2ba8ad7c6dcdfc7af@AcuMS.aculab.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 17/03/2021 à 13:51, David Laight a écrit : > From: Christophe Leroy >> Sent: 16 March 2021 15:41 > ... >>>> include/linux/types.h:typedef __kernel_ptrdiff_t ptrdiff_t; >>>> >>>> And get: >>>> >>>> CC mm/kfence/report.o >>>> In file included from ./include/linux/printk.h:7, >>>> from ./include/linux/kernel.h:16, >>>> from mm/kfence/report.c:10: >>>> mm/kfence/report.c: In function 'kfence_report_error': >>>> ./include/linux/kern_levels.h:5:18: warning: format '%td' expects argument >>>> of type 'ptrdiff_t', but argument 6 has type 'long int' [-Wformat=] >>> >>> This is declared as >>> const ptrdiff_t object_index = meta ? meta - kfence_metadata : -1; >>> so maybe something with that goes wrong? What happens if you delete the >>> (useless) "const" here? > > The obvious thing to try is changing it to 'int'. > That will break 64bit builds, but if it fixes the 32bit one > it will tell you what type gcc is expecting. > Yes, if defining 'object_index' as int, gcc is happy. If removing the powerpc re-definition of ptrdiff_t typedef in https://elixir.bootlin.com/linux/v5.12-rc3/source/arch/powerpc/include/uapi/asm/posix_types.h , it works great as well. So seems like gcc doesn't take into account the typedef behind ptrdiff_t, it just expects it to be int on 32 bits ? Christophe