From: Segher Boessenkool <segher@kernel.crashing.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
llvm@lists.linux.dev, Nick Desaulniers <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org,
Nathan Chancellor <nathan@kernel.org>,
Bill Wendling <morbo@google.com>,
linux-serial@vger.kernel.org,
Justin Stitt <justinstitt@google.com>,
Jiri Slaby <jirislaby@kernel.org>
Subject: Re: [PATCH] tty: hvc-iucv: fix function pointer casts
Date: Tue, 13 Feb 2024 13:12:54 -0600 [thread overview]
Message-ID: <20240213191254.GA19790@gate.crashing.org> (raw)
In-Reply-To: <20240213101756.461701-1-arnd@kernel.org>
On Tue, Feb 13, 2024 at 11:17:49AM +0100, Arnd Bergmann wrote:
> clang warns about explicitly casting between incompatible function
> pointers:
>
> drivers/tty/hvc/hvc_iucv.c:1100:23: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
> 1100 | priv->dev->release = (void (*)(struct device *)) kfree;
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Such a cast of course is explicitly allowed by 6.3.2.3/8, only calling a
function using a non-compatible type is UB. This warning message is
quite misleading. Doubly so because of the -Werror, as always.
Your proposed new code of course is nice and simple (albeit a bit bigger
than it was before, both source and binary). Such is life ;-)
Segher
next prev parent reply other threads:[~2024-02-13 19:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 10:17 [PATCH] tty: hvc-iucv: fix function pointer casts Arnd Bergmann
2024-02-13 19:12 ` Segher Boessenkool [this message]
2024-02-14 9:46 ` David Laight
2024-02-14 10:37 ` Greg Kroah-Hartman
2024-02-14 12:36 ` Segher Boessenkool
2024-02-14 6:25 ` Jiri Slaby
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=20240213191254.GA19790@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.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;
as well as URLs for NNTP newsgroup(s).