From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751883AbdITImU convert rfc822-to-8bit (ORCPT ); Wed, 20 Sep 2017 04:42:20 -0400 Received: from smtp-out4.electric.net ([192.162.216.195]:64233 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbdITImQ (ORCPT ); Wed, 20 Sep 2017 04:42:16 -0400 From: David Laight To: "'Helge Deller'" , "'Sergey Senozhatsky'" CC: Fenghua Yu , "Luck, Tony" , "linux-ia64@vger.kernel.org" , Petr Mladek , Jessica Yu , "James E . J . Bottomley" , Steven Rostedt , "Alexei Starovoitov" , Sergey Senozhatsky , Paul Mackerras , "Andrew Morton" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Thread-Topic: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Thread-Index: AQHTMOwDT4Uu8fKFA0OVdqOPpU6rUKK8NouggABcsoCAAOKrsA== Date: Wed, 20 Sep 2017 08:41:40 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD007AF31@AcuExch.aculab.com> References: <20170916035347.19705-1-sergey.senozhatsky@gmail.com> <20170918174432.4fksyzco2g6gczwe@intel.com> <20170918183902.GA30752@p100.box> <20170919020537.GA16991@jagdpanzerIV.localdomain> <063D6719AE5E284EB5DD2968C1650D6DD007A0D0@AcuExch.aculab.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Helge Deller > Sent: 19 September 2017 21:08 ... > > Using 'unsigned long' for any kind of pointer is an accident > > waiting do happen. > > It also makes it difficult to typecheck the function calls. > > Using 'void *' isn't any better. > > Either a pointer to an undefined struct, or a struct containing > > a single 'char' member, is likely to be safest. > > David, you might be right in most cases, but in this case I'd prefer > unsigned long too. I think this will create the least amount of > typecasts here. I've not looked at the specifics case... Another option is using a struct with a single member and passing it by value. This could be used for things like user-space pointers or even errno values. The only problem is old ABI where even small structures are always passed by reference. David From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out4.electric.net (smtp-out4.electric.net [192.162.216.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xxtXT5cR6zDqlw for ; Wed, 20 Sep 2017 18:42:17 +1000 (AEST) From: David Laight To: 'Helge Deller' , 'Sergey Senozhatsky' CC: Fenghua Yu , "Luck, Tony" , "linux-ia64@vger.kernel.org" , Petr Mladek , Jessica Yu , "James E . J . Bottomley" , Steven Rostedt , "Alexei Starovoitov" , Sergey Senozhatsky , Paul Mackerras , "Andrew Morton" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 0/5] [RFC] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Date: Wed, 20 Sep 2017 08:41:40 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD007AF31@AcuExch.aculab.com> References: <20170916035347.19705-1-sergey.senozhatsky@gmail.com> <20170918174432.4fksyzco2g6gczwe@intel.com> <20170918183902.GA30752@p100.box> <20170919020537.GA16991@jagdpanzerIV.localdomain> <063D6719AE5E284EB5DD2968C1650D6DD007A0D0@AcuExch.aculab.com> In-Reply-To: Content-Type: text/plain; charset="Windows-1252" MIME-Version: 1.0 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Helge Deller > Sent: 19 September 2017 21:08 ... > > Using 'unsigned long' for any kind of pointer is an accident > > waiting do happen. > > It also makes it difficult to typecheck the function calls. > > Using 'void *' isn't any better. > > Either a pointer to an undefined struct, or a struct containing > > a single 'char' member, is likely to be safest. >=20 > David, you might be right in most cases, but in this case I'd prefer > unsigned long too. I think this will create the least amount of > typecasts here. I've not looked at the specifics case... Another option is using a struct with a single member and passing it by value. This could be used for things like user-space pointers or even errno values. The only problem is old ABI where even small structures are always passed by reference. David