lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd97ad2754112d8b9251fc1a1ce0cd15fbfa7eb4.camel@hammerspace.com>
Date: Fri, 30 Aug 2024 02:08:09 +0000
From: Trond Myklebust <trondmy@...merspace.com>
To: "davem@...emloft.net" <davem@...emloft.net>, "chuck.lever@...cle.com"
	<chuck.lever@...cle.com>, "anna@...nel.org" <anna@...nel.org>,
	"pabeni@...hat.com" <pabeni@...hat.com>, "jlayton@...nel.org"
	<jlayton@...nel.org>, "edumazet@...gle.com" <edumazet@...gle.com>,
	"kuba@...nel.org" <kuba@...nel.org>, "yanzhen@...o.com" <yanzhen@...o.com>
CC: "opensource.kernel@...o.com" <opensource.kernel@...o.com>,
	"okorniev@...hat.com" <okorniev@...hat.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "tom@...pey.com" <tom@...pey.com>,
	"Dai.Ngo@...cle.com" <Dai.Ngo@...cle.com>, "linux-nfs@...r.kernel.org"
	<linux-nfs@...r.kernel.org>, "neilb@...e.de" <neilb@...e.de>
Subject: Re: [PATCH net-next v1] sunrpc: Use ERR_CAST() to return

On Fri, 2024-08-30 at 09:42 +0800, Yan Zhen wrote:
> Using ERR_CAST() is more reasonable and safer, When it is necessary
> to convert the type of an error pointer and return it.

static inline void * __must_check ERR_CAST(__force const void *ptr)
{
        /* cast away the const */
        return (void *) ptr;
}

That function is literally just doing an implicit cast from whatever
pointer type it is now, to a 'const void *' and then to a 'void *',
which then gets implicitly cast to whatever type the caller is
expecting. Exactly how is that "safer" than the current explicit cast?

While it is great that ERR_CAST() exists, and I agree that it should be
preferred in newer code for the (sole (!)) reason that it documents
that we expect this to be an error, I see no reason why it is
imperative to apply that change to existing code. Particularly not as a
standalone patch.

So NACK for now.


-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@...merspace.com


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ