Message ID | 20240213100548.457854-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-63305-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp439909dyb; Tue, 13 Feb 2024 02:14:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXcIsFWI5O//9NLGfsCZgpm0OGznEXQ8JMG73iG7Aj5mkS3ScQcl/2NiQpqT0NTrlq+HJApl1qx0AB0bYxhEWYg8sCxvA== X-Google-Smtp-Source: AGHT+IE6cuMWMwatb1hPfskP12eRVLX6eSrtq+bkx9w9Pq0LZfvkb0+ujkFhXMaiVJ0Fvb4VN/ff X-Received: by 2002:a05:6a21:2d8f:b0:19e:cce1:ed7d with SMTP id ty15-20020a056a212d8f00b0019ecce1ed7dmr7268729pzb.32.1707819265747; Tue, 13 Feb 2024 02:14:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707819265; cv=pass; d=google.com; s=arc-20160816; b=CH0JmbnusdiWWpIObuVkNIe8+C39hBsNN4MfJgxyJ0/nea+WjqpG5RSf6NbaJN0WB4 HZn/tqRVyxJVOjX6ZI1CmPVW18KMbvCmzuyZVqjwlq6G0YBBv9M5V/bORgy0T6qQBFfu no/QIQrqFtfRNdmtGfJEbSJwIK5I5O7yj+4SiyTh7V7FGrwWJAXFhRJ2ZJooMnvvymfw gi0yCj6B0Grn6dwNQuyZwzTOYDCL2iGzkEXu6Ty2Ig9mfFLrxL7fV9H6bMXb0gYwq0RH rwmPrAGey93TnTOOqbrKr5IDbaD3HV9rnEW/5pT90C46/XRPVnkmNApsMUqq0FB9KPjE qqSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=BfCDf4NHbHsbeg+pkipqCl0rLflF5gdiWAIhvUp3lPQ=; fh=A0SgoxNnfYrkRngsIUIibHhYY9nQTFaROzYWSF+Eewc=; b=FgoHLtZ5/CyKYa3QbQgsCeb5/lla7A2hyYIC31DTkfw3SCqpDbQlPAqu0WzDCOOdb6 HAE95R+aMHJmGYfj6cK4bBq5fL1KosOL+fnt/xMckxBSMPCvlEPEMP6tghuKOAuo1bc6 124j2A/1y+mTAyi+5A93c+HZ3iSY+y64pZD3+pLADEN0mzgFpaZ/puOMEQ9EtMO/T1cD R8PPBhTk4rzuqqYKTyb374wqYgy19yXu9Bhvru8/E90F9++C113p24iDEdQCaP9pZtwE O3d9XRcs+fAbJjmtb4/ydqzA/ayzgZ4pjVwqZDK4Q5+urPkhuvaiXkf//d9wYG1lfLdf LPNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ksr6Pj7t; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63305-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63305-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCU2xjbnsKId1V+XCMDFoT9UkExxuZ8l52bcoLy1jUO+qzKqB8LmMt6D5Yj8d9L+ITkcq1Rua1NLzBRtdQAdnv3aQvJ8Yg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y20-20020a056a00181400b006e02a7721aasi6579836pfa.53.2024.02.13.02.14.25 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 02:14:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63305-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ksr6Pj7t; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63305-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63305-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 402BD28E5C7 for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 10:06:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9C3F22EE3; Tue, 13 Feb 2024 10:05:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ksr6Pj7t" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2924A224DE; Tue, 13 Feb 2024 10:05:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818755; cv=none; b=pTV60BnPkbUSTmUSkgW0adtG3/LvoFLiGODKSrL8DI1OQvL5ajF23Xo+6+Si2LzexN/JwZgw4WNE3yNrJKDVht/xooBHgJ4HNTwxeA2ZgeQN4LKPGRNQZDIDD0JfFdU46qx3oWr3PFcPD7MGlB9d6SzWpQi9ZJfxJrdW6RpaO+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818755; c=relaxed/simple; bh=WcxErgsyfFXrzhYEDf5rpkuxyuJrLmqXvy8MMKBGXI4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=PrgnddatImdoC7SscqkedLcbI2ZvJVekZda0rTO98o6zaKWbpplmKqhxSo93lowF9wjgGKBZPwO/pfTSEsrpAnCuqTZWTb7Q2JWbGnN6hVJ0uaElM/6U6BMvJCRYDgKMqQ3JuFkrAudfMlRriUoeexXrwE3jWURhHX1xPVu2mXg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ksr6Pj7t; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2038C433C7; Tue, 13 Feb 2024 10:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707818755; bh=WcxErgsyfFXrzhYEDf5rpkuxyuJrLmqXvy8MMKBGXI4=; h=From:To:Cc:Subject:Date:From; b=ksr6Pj7tO+yUgZ8iAlv3c/Pj1vMUt6E3wElItA3YLBnLiVNvXsKdoBKa+RgkE+IOS o4vtDL5C6Jlx3laUNxU2lS2rERHlAFAWUTn9LkVJGRUulO46zGXA8CHfQv2EoK4M+4 Gr5JsMMN6xxcA1uPI8g3I4ZnaMYbyUrg1uYsGuVpTHzghcCl6a5zOXTCxVUfmkzp9a RLST521KRjwDe/6oimNzWc7ySZBwrg72nYL2Ira1q7HLpT4fcYznWRIgoTd30HiUxA BFw47WycdaE6G+iM0F6c7yeDCbaoeIKOuB1dEPjR7A0KgHcSIGuLZ9djvhbh1QDjkt rcAgl6U2d6PjA== From: Arnd Bergmann <arnd@kernel.org> To: Arend van Spriel <arend.vanspriel@broadcom.com>, Kalle Valo <kvalo@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Greg Kroah-Hartman <gregkh@suse.de>, Pieter-Paul Giesberts <pieterpg@broadcom.com> Cc: Arnd Bergmann <arnd@arndb.de>, Nick Desaulniers <ndesaulniers@google.com>, Bill Wendling <morbo@google.com>, Justin Stitt <justinstitt@google.com>, Artem Chernyshev <artem.chernyshev@red-soft.ru>, Jonas Gorski <jonas.gorski@gmail.com>, linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] brcmsmac: avoid function pointer casts Date: Tue, 13 Feb 2024 11:05:37 +0100 Message-Id: <20240213100548.457854-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790778294387498562 X-GMAIL-MSGID: 1790778294387498562 |
Series |
brcmsmac: avoid function pointer casts
|
|
Commit Message
Arnd Bergmann
Feb. 13, 2024, 10:05 a.m. UTC
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(-)
Comments
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?
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
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
"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.
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?
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
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
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);