brcm80211.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmsmac: avoid function pointer casts
@ 2024-02-13 10:05 Arnd Bergmann
  2024-02-14  8:45 ` Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Arnd Bergmann @ 2024-02-13 10:05 UTC (permalink / raw)
  To: Arend van Spriel, Kalle Valo, Nathan Chancellor,
	Greg Kroah-Hartman, Pieter-Paul Giesberts
  Cc: Arnd Bergmann, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Artem Chernyshev, Jonas Gorski, linux-wireless, brcm80211,
	brcm80211-dev-list.pdl, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

An old cleanup went a little too far and causes a warning with clang-16
and higher as it breaks control flow integrity (KCFI) rules:

drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
   64 |                         brcms_init_timer(physhim->wl, (void (*)(void *))fn,
      |                                                       ^~~~~~~~~~~~~~~~~~~~

Change this one instance back to passing a void pointer so it can be
used with the timer callback interface.

Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c   | 3 ++-
 drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c  | 5 ++---
 drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c
index 07f83ff5a54a..a27d6f0b8819 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -383,8 +383,9 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp)
 	return sh;
 }
 
-static void wlc_phy_timercb_phycal(struct brcms_phy *pi)
+static void wlc_phy_timercb_phycal(void *ptr)
 {
+	struct brcms_phy *pi = ptr;
 	uint delay = 5;
 
 	if (PHY_PERICAL_MPHASE_PENDING(pi)) {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c
index a0de5db0cd64..b72381791536 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c
@@ -57,12 +57,11 @@ void wlc_phy_shim_detach(struct phy_shim_info *physhim)
 }
 
 struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim,
-				     void (*fn)(struct brcms_phy *pi),
+				     void (*fn)(void *pi),
 				     void *arg, const char *name)
 {
 	return (struct wlapi_timer *)
-			brcms_init_timer(physhim->wl, (void (*)(void *))fn,
-					 arg, name);
+			brcms_init_timer(physhim->wl, fn, arg, name);
 }
 
 void wlapi_free_timer(struct wlapi_timer *t)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h
index dd8774717ade..27d0934e600e 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h
@@ -131,7 +131,7 @@ void wlc_phy_shim_detach(struct phy_shim_info *physhim);
 
 /* PHY to WL utility functions */
 struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim,
-				     void (*fn)(struct brcms_phy *pi),
+				     void (*fn)(void *pi),
 				     void *arg, const char *name);
 void wlapi_free_timer(struct wlapi_timer *t);
 void wlapi_add_timer(struct wlapi_timer *t, uint ms, int periodic);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] brcmsmac: avoid function pointer casts
  2024-02-13 10:05 [PATCH] brcmsmac: avoid function pointer casts Arnd Bergmann
@ 2024-02-14  8:45 ` Kalle Valo
  2024-02-14  9:23   ` Arend van Spriel
  2024-02-15 10:33 ` Kalle Valo
  2024-02-16 15:49 ` wifi: " Kalle Valo
  2 siblings, 1 reply; 8+ messages in thread
From: Kalle Valo @ 2024-02-14  8:45 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arend van Spriel, Nathan Chancellor, Greg Kroah-Hartman,
	Pieter-Paul Giesberts, Arnd Bergmann, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Artem Chernyshev, Jonas Gorski,
	linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel,
	llvm

Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> An old cleanup went a little too far and causes a warning with clang-16
> and higher as it breaks control flow integrity (KCFI) rules:
> 
> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>    64 |                         brcms_init_timer(physhim->wl, (void (*)(void *))fn,
>       |                                                       ^~~~~~~~~~~~~~~~~~~~
> 
> Change this one instance back to passing a void pointer so it can be
> used with the timer callback interface.
> 
> Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I guess this should go to wireless tree?

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20240213100548.457854-1-arnd@kernel.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] brcmsmac: avoid function pointer casts
  2024-02-14  8:45 ` Kalle Valo
@ 2024-02-14  9:23   ` Arend van Spriel
  2024-02-14 15:07     ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Arend van Spriel @ 2024-02-14  9:23 UTC (permalink / raw)
  To: Kalle Valo, Arnd Bergmann
  Cc: Nathan Chancellor, Greg Kroah-Hartman, Pieter-Paul Giesberts,
	Arnd Bergmann, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Artem Chernyshev, Jonas Gorski, linux-wireless, brcm80211,
	brcm80211-dev-list.pdl, linux-kernel, llvm

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]

On 2/14/2024 9:45 AM, Kalle Valo wrote:
> Arnd Bergmann <arnd@kernel.org> wrote:
> 
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> An old cleanup went a little too far and causes a warning with clang-16
>> and higher as it breaks control flow integrity (KCFI) rules:
>>
>> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>>     64 |                         brcms_init_timer(physhim->wl, (void (*)(void *))fn,
>>        |                                                       ^~~~~~~~~~~~~~~~~~~~
>>
>> Change this one instance back to passing a void pointer so it can be
>> used with the timer callback interface.
>>
>> Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> I guess this should go to wireless tree?

This has been like this forever looking at the "staging" part in the 
Fixes tag. Is it really so urgent now? On the other hand I have no real 
problem with moving this to the wireless tree. Just wondering out loud.

Regards,
Arend

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] brcmsmac: avoid function pointer casts
  2024-02-14  9:23   ` Arend van Spriel
@ 2024-02-14 15:07     ` Arnd Bergmann
  2024-02-14 17:55       ` Kalle Valo
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2024-02-14 15:07 UTC (permalink / raw)
  To: Arend van Spriel, Kalle Valo, Arnd Bergmann
  Cc: Nathan Chancellor, Greg Kroah-Hartman, Pieter-Paul Giesberts,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Artem Chernyshev,
	Jonas Gorski, linux-wireless, brcm80211, brcm80211-dev-list.pdl,
	linux-kernel, llvm

On Wed, Feb 14, 2024, at 10:23, Arend van Spriel wrote:
> On 2/14/2024 9:45 AM, Kalle Valo wrote:
>> Arnd Bergmann <arnd@kernel.org> wrote:
>> 
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> An old cleanup went a little too far and causes a warning with clang-16
>>> and higher as it breaks control flow integrity (KCFI) rules:
>>>
>>> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>>>     64 |                         brcms_init_timer(physhim->wl, (void (*)(void *))fn,
>>>        |                                                       ^~~~~~~~~~~~~~~~~~~~
>>>
>>> Change this one instance back to passing a void pointer so it can be
>>> used with the timer callback interface.
>>>
>>> Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy")
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> 
>> I guess this should go to wireless tree?
>
> This has been like this forever looking at the "staging" part in the 
> Fixes tag. Is it really so urgent now? On the other hand I have no real 
> problem with moving this to the wireless tree. Just wondering out loud.

It's probably fine either way. Some maintainers like to backport
the warning fixes to stable kernels, others don't. Since the
warning is currently only enabled at W=1 level, it's probably fine
to fix it for linux-next only, but if we want the fix backported,
it should also go into 6.8.

    Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] brcmsmac: avoid function pointer casts
  2024-02-14 15:07     ` Arnd Bergmann
@ 2024-02-14 17:55       ` Kalle Valo
  0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2024-02-14 17:55 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arend van Spriel, Arnd Bergmann, Nathan Chancellor,
	Greg Kroah-Hartman, Pieter-Paul Giesberts, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Artem Chernyshev, Jonas Gorski,
	linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel,
	llvm

"Arnd Bergmann" <arnd@arndb.de> writes:

> On Wed, Feb 14, 2024, at 10:23, Arend van Spriel wrote:
>
>> On 2/14/2024 9:45 AM, Kalle Valo wrote:
>>> Arnd Bergmann <arnd@kernel.org> wrote:
>>> 
>>>> From: Arnd Bergmann <arnd@arndb.de>
>>>>
>>>> An old cleanup went a little too far and causes a warning with clang-16
>>>> and higher as it breaks control flow integrity (KCFI) rules:
>>>>
>>>> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>>>>     64 |                         brcms_init_timer(physhim->wl, (void (*)(void *))fn,
>>>>        |                                                       ^~~~~~~~~~~~~~~~~~~~
>>>>
>>>> Change this one instance back to passing a void pointer so it can be
>>>> used with the timer callback interface.
>>>>
>>>> Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy")
>>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> 
>>> I guess this should go to wireless tree?
>>
>> This has been like this forever looking at the "staging" part in the 
>> Fixes tag. Is it really so urgent now? On the other hand I have no real 
>> problem with moving this to the wireless tree. Just wondering out loud.
>
> It's probably fine either way. Some maintainers like to backport
> the warning fixes to stable kernels, others don't. Since the
> warning is currently only enabled at W=1 level, it's probably fine
> to fix it for linux-next only, but if we want the fix backported,
> it should also go into 6.8.

Thanks, let's take it wireless-next then.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] brcmsmac: avoid function pointer casts
  2024-02-13 10:05 [PATCH] brcmsmac: avoid function pointer casts Arnd Bergmann
  2024-02-14  8:45 ` Kalle Valo
@ 2024-02-15 10:33 ` Kalle Valo
  2024-02-15 13:48   ` Arend Van Spriel
  2024-02-16 15:49 ` wifi: " Kalle Valo
  2 siblings, 1 reply; 8+ messages in thread
From: Kalle Valo @ 2024-02-15 10:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arend van Spriel, Nathan Chancellor, Greg Kroah-Hartman,
	Pieter-Paul Giesberts, Arnd Bergmann, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Artem Chernyshev, Jonas Gorski,
	linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel,
	llvm

Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> An old cleanup went a little too far and causes a warning with clang-16
> and higher as it breaks control flow integrity (KCFI) rules:
> 
> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>    64 |                         brcms_init_timer(physhim->wl, (void (*)(void *))fn,
>       |                                                       ^~~~~~~~~~~~~~~~~~~~
> 
> Change this one instance back to passing a void pointer so it can be
> used with the timer callback interface.
> 
> Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I can add 'wifi:' during commit. Arend, ack?

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20240213100548.457854-1-arnd@kernel.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] brcmsmac: avoid function pointer casts
  2024-02-15 10:33 ` Kalle Valo
@ 2024-02-15 13:48   ` Arend Van Spriel
  0 siblings, 0 replies; 8+ messages in thread
From: Arend Van Spriel @ 2024-02-15 13:48 UTC (permalink / raw)
  To: Kalle Valo, Arnd Bergmann
  Cc: Nathan Chancellor, Greg Kroah-Hartman, Pieter-Paul Giesberts,
	Arnd Bergmann, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Artem Chernyshev, Jonas Gorski, linux-wireless, brcm80211,
	brcm80211-dev-list.pdl, linux-kernel, llvm

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

On February 15, 2024 11:33:30 AM Kalle Valo <kvalo@kernel.org> wrote:

> Arnd Bergmann <arnd@kernel.org> wrote:
>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> An old cleanup went a little too far and causes a warning with clang-16
>> and higher as it breaks control flow integrity (KCFI) rules:
>>
>> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: 
>> cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to 
>> incompatible function type [-Werror,-Wcast-function-type-strict]
>> 64 |                         brcms_init_timer(physhim->wl, (void (*)(void 
>> *))fn,
>> |                                                       ^~~~~~~~~~~~~~~~~~~~
>>
>> Change this one instance back to passing a void pointer so it can be
>> used with the timer callback interface.
>>
>> Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> I can add 'wifi:' during commit. Arend, ack?

Here it is:

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

>
> --
> https://patchwork.kernel.org/project/linux-wireless/patch/20240213100548.457854-1-arnd@kernel.org/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches




[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: wifi: brcmsmac: avoid function pointer casts
  2024-02-13 10:05 [PATCH] brcmsmac: avoid function pointer casts Arnd Bergmann
  2024-02-14  8:45 ` Kalle Valo
  2024-02-15 10:33 ` Kalle Valo
@ 2024-02-16 15:49 ` Kalle Valo
  2 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2024-02-16 15:49 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arend van Spriel, Nathan Chancellor, Greg Kroah-Hartman,
	Pieter-Paul Giesberts, Arnd Bergmann, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Artem Chernyshev, Jonas Gorski,
	linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel,
	llvm

Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> An old cleanup went a little too far and causes a warning with clang-16
> and higher as it breaks control flow integrity (KCFI) rules:
> 
> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: cast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>    64 |                         brcms_init_timer(physhim->wl, (void (*)(void *))fn,
>       |                                                       ^~~~~~~~~~~~~~~~~~~~
> 
> Change this one instance back to passing a void pointer so it can be
> used with the timer callback interface.
> 
> Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

Patch applied to wireless-next.git, thanks.

e1ea6db35fc3 wifi: brcmsmac: avoid function pointer casts

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20240213100548.457854-1-arnd@kernel.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-16 15:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 10:05 [PATCH] brcmsmac: avoid function pointer casts Arnd Bergmann
2024-02-14  8:45 ` Kalle Valo
2024-02-14  9:23   ` Arend van Spriel
2024-02-14 15:07     ` Arnd Bergmann
2024-02-14 17:55       ` Kalle Valo
2024-02-15 10:33 ` Kalle Valo
2024-02-15 13:48   ` Arend Van Spriel
2024-02-16 15:49 ` wifi: " Kalle Valo

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).