[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87eddgxzrx.wl-tiwai@suse.de>
Date: Tue, 13 Feb 2024 14:24:50 +0100
From: Takashi Iwai <tiwai@...e.de>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Arnd Bergmann <arnd@...db.de>,
Wai Yew CHAY <wychay@....creative.com>,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ALSA: ctxfi: avoid casting function pointers
On Tue, 13 Feb 2024 11:12:46 +0100,
Arnd Bergmann wrote:
>
> From: Arnd Bergmann <arnd@...db.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@...db.de>
Thanks, applied.
Takashi
Powered by blists - more mailing lists