linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Oscar Carter <oscar.carter@gmx.com>
Cc: Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	kernel-hardening@lists.openwall.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/irqchip: Remove function callback casts
Date: Sun, 24 May 2020 12:46:34 +0100	[thread overview]
Message-ID: <20200524124634.113203f6@why> (raw)
In-Reply-To: <20200524080910.13087-1-oscar.carter@gmx.com>

On Sun, 24 May 2020 10:09:10 +0200
Oscar Carter <oscar.carter@gmx.com> wrote:

Hi Oscar,

Thanks for this. Comments below.

> In an effort to enable -Wcast-function-type in the top-level Makefile to
> support Control Flow Integrity builds, remove all the function callback
> casts.
> 
> To do this, modify the IRQCHIP_ACPI_DECLARE macro initializing the
> acpi_probe_entry struct directly instead of use the existent macro
> ACPI_DECLARE_PROBE_ENTRY.
> 
> In this new initialization use the probe_subtbl field instead of the
> probe_table field use in the ACPI_DECLARE_PROBE_ENTRY macro.

Please add *why* this is a valid transformation (probe_table and
probe_subtbl are part of a union).

> 
> Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
> ---
>  include/linux/irqchip.h | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
> index 950e4b2458f0..1f464fd10df0 100644
> --- a/include/linux/irqchip.h
> +++ b/include/linux/irqchip.h
> @@ -39,8 +39,14 @@
>   * @fn: initialization function
>   */
>  #define IRQCHIP_ACPI_DECLARE(name, subtable, validate, data, fn)	\
> -	ACPI_DECLARE_PROBE_ENTRY(irqchip, name, ACPI_SIG_MADT, 		\
> -				 subtable, validate, data, fn)
> +	static const struct acpi_probe_entry __acpi_probe_##name	\
> +		__used __section(__irqchip_acpi_probe_table) = {	\
> +			.id = ACPI_SIG_MADT,				\
> +			.type = subtable,				\
> +			.subtable_valid = validate,			\
> +			.probe_subtbl = (acpi_tbl_entry_handler)fn,	\
> +			.driver_data = data,				\
> +		}
> 

I'd rather you add an ACPI_DECLARE_SUBTABLE_PROBE_ENTRY to acpi.h, and
use that here so that we can keep the ACPI gunk in a single place.

>  #ifdef CONFIG_IRQCHIP
>  void irqchip_init(void);
> --
> 2.20.1
> 
> 

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2020-05-24 11:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24  8:09 [PATCH] drivers/irqchip: Remove function callback casts Oscar Carter
2020-05-24 11:46 ` Marc Zyngier [this message]
2020-05-24 16:06   ` Oscar Carter
2020-05-24 16:16     ` Marc Zyngier
2020-05-26 17:32       ` Oscar Carter

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=20200524124634.113203f6@why \
    --to=maz@kernel.org \
    --cc=jason@lakedaemon.net \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oscar.carter@gmx.com \
    --cc=tglx@linutronix.de \
    /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).