public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Segher Boessenkool' <segher@kernel.crashing.org>,
	Arnd Bergmann <arnd@kernel.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	Nick Desaulniers <ndesaulniers@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	"Bill Wendling" <morbo@google.com>,
	"linux-serial@vger.kernel.org" <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: Wed, 14 Feb 2024 09:46:33 +0000	[thread overview]
Message-ID: <57d72e2ccc8245fe99982613a11c461c@AcuMS.aculab.com> (raw)
In-Reply-To: <20240213191254.GA19790@gate.crashing.org>

From: Segher Boessenkool
> Sent: 13 February 2024 19:13
> 
> 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.

But it will get called using the wrong type.
And (is it) fine-ibt will reject the incorrect call.

Has clang/gcc added an attribute to 'seed' the ibt hash yet?
So that functions that are void (*)(void) can be separated?

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2024-02-14  9:46 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
2024-02-14  9:46   ` David Laight [this message]
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=57d72e2ccc8245fe99982613a11c461c@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --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 \
    --cc=segher@kernel.crashing.org \
    /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