From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Trond Myklebust <trondmy@hammerspace.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"chuck.lever@oracle.com" <chuck.lever@oracle.com>,
"anna@kernel.org" <anna@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"jlayton@kernel.org" <jlayton@kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"yanzhen@vivo.com" <yanzhen@vivo.com>,
"opensource.kernel@vivo.com" <opensource.kernel@vivo.com>,
"okorniev@redhat.com" <okorniev@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"tom@talpey.com" <tom@talpey.com>,
"Dai.Ngo@oracle.com" <Dai.Ngo@oracle.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"neilb@suse.de" <neilb@suse.de>
Subject: Re: [PATCH net-next v1] sunrpc: Use ERR_CAST() to return
Date: Fri, 30 Aug 2024 15:39:24 +0200 [thread overview]
Message-ID: <92e3c3f9-3ee7-43d4-a4af-70ca87adacb2@intel.com> (raw)
In-Reply-To: <dd97ad2754112d8b9251fc1a1ce0cd15fbfa7eb4.camel@hammerspace.com>
From: Trond Myklebust <trondmy@hammerspace.com>
Date: Fri, 30 Aug 2024 02:08:09 +0000
> 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?
I think we might want to reimplement ERR_CAST() using _Generic() to not
cast away const when the argument itself is const.
>
> 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.
Thanks,
Olek
next prev parent reply other threads:[~2024-08-30 13:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 1:42 Yan Zhen
2024-08-30 2:08 ` Trond Myklebust
2024-08-30 13:39 ` Alexander Lobakin [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-08-29 13:04 Yan Zhen
2024-08-29 13:11 ` Jeff Layton
2024-08-29 14:53 ` Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92e3c3f9-3ee7-43d4-a4af-70ca87adacb2@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jlayton@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=okorniev@redhat.com \
--cc=opensource.kernel@vivo.com \
--cc=pabeni@redhat.com \
--cc=tom@talpey.com \
--cc=trondmy@hammerspace.com \
--cc=yanzhen@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®