All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Wai Yew CHAY <wychay@ctl.creative.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: ctxfi: avoid casting function pointers
Date: Tue, 13 Feb 2024 14:24:50 +0100	[thread overview]
Message-ID: <87eddgxzrx.wl-tiwai@suse.de> (raw)
In-Reply-To: <20240213101303.460008-1-arnd@kernel.org>

On Tue, 13 Feb 2024 11:12:46 +0100,
Arnd Bergmann wrote:
> 
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This driver creates an abstraction for different components by casting function
> pointers to slightly incompatible types for each one to get the correct
> argument even when the caller does not know those types. This is a
> bit unreliable and not allowed in combination with control flow integrity
> (KCFI):
> 
> sound/pci/ctxfi/ctatc.c:115:25: error: cast from 'int (*)(struct hw *, struct src_mgr **)' to 'create_t' (aka 'int (*)(struct hw *, void **)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>   115 |         [SRC]           = { .create     = (create_t)src_mgr_create,
>       |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
> sound/pci/ctxfi/ctatc.c:116:20: error: cast from 'int (*)(struct src_mgr *)' to 'destroy_t' (aka 'int (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>   116 |                             .destroy    = (destroy_t)src_mgr_destroy    },
>       |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
> sound/pci/ctxfi/ctatc.c:117:27: error: cast from 'int (*)(struct hw *, struct srcimp_mgr **)' to 'create_t' (aka 'int (*)(struct hw *, void **)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>   117 |         [SRCIMP]        = { .create     = (create_t)srcimp_mgr_create,
>       |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> sound/pci/ctxfi/ctatc.c:118:20: error: cast from 'int (*)(struct srcimp_mgr *)' to 'destroy_t' (aka 'int (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>   118 |                             .destroy    = (destroy_t)srcimp_mgr_destroy },
>       |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Change these to always pass void pointers and move the abstraction one level
> down.
> 
> Fixes: 8cc72361481f ("ALSA: SB X-Fi driver merge")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks, applied.


Takashi

      reply	other threads:[~2024-02-13 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 10:12 [PATCH] ALSA: ctxfi: avoid casting function pointers Arnd Bergmann
2024-02-13 13:24 ` Takashi Iwai [this message]

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=87eddgxzrx.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=wychay@ctl.creative.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.