All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Nathan Chancellor <nathan@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Kory Maincent <kory.maincent@bootlin.com>,
	netdev@vger.kernel.org, llvm@lists.linux.dev,
	patches@lists.linux.dev
Subject: Re: [PATCH net-next] net: netcp: ethss: Fix type of first parameter in hwtstamp stubs
Date: Sat, 8 Nov 2025 12:43:54 +0000	[thread overview]
Message-ID: <01dbac10-fbe3-4211-bf8a-eb622df81f64@linux.dev> (raw)
In-Reply-To: <20251107-netcp_ethss-fix-cpts-stubs-clang-wifpts-v1-1-a80a30c429a8@kernel.org>

On 08/11/2025 03:19, Nathan Chancellor wrote:
> When building with -Wincompatible-function-pointer-types-strict, a
> warning designed to catch control flow integrity violations at compile
> time, there are several instances in netcp_ethss.c when CONFIG_TI_CPTS
> is not set:
> 
>    drivers/net/ethernet/ti/netcp_ethss.c:3831:18: warning: incompatible function pointer types initializing 'int (*)(void *, struct kernel_hwtstamp_config *)' with an expression of type 'int (struct gbe_intf *, struct kernel_hwtstamp_config *)' [-Wincompatible-function-pointer-types-strict]
>     3831 |         .hwtstamp_get   = gbe_hwtstamp_get,
>          |                           ^~~~~~~~~~~~~~~~
>    drivers/net/ethernet/ti/netcp_ethss.c:3832:18: warning: incompatible function pointer types initializing 'int (*)(void *, struct kernel_hwtstamp_config *, struct netlink_ext_ack *)' with an expression of type 'int (struct gbe_intf *, struct kernel_hwtstamp_config *, struct netlink_ext_ack *)' [-Wincompatible-function-pointer-types-strict]
>     3832 |         .hwtstamp_set   = gbe_hwtstamp_set,
>          |                           ^~~~~~~~~~~~~~~~
>    drivers/net/ethernet/ti/netcp_ethss.c:3850:18: warning: incompatible function pointer types initializing 'int (*)(void *, struct kernel_hwtstamp_config *)' with an expression of type 'int (struct gbe_intf *, struct kernel_hwtstamp_config *)' [-Wincompatible-function-pointer-types-strict]
>     3850 |         .hwtstamp_get   = gbe_hwtstamp_get,
>          |                           ^~~~~~~~~~~~~~~~
>    drivers/net/ethernet/ti/netcp_ethss.c:3851:18: warning: incompatible function pointer types initializing 'int (*)(void *, struct kernel_hwtstamp_config *, struct netlink_ext_ack *)' with an expression of type 'int (struct gbe_intf *, struct kernel_hwtstamp_config *, struct netlink_ext_ack *)' [-Wincompatible-function-pointer-types-strict]
>     3851 |         .hwtstamp_set   = gbe_hwtstamp_set,
>          |                           ^~~~~~~~~~~~~~~~
> 
> While 'void *' and 'struct gbe_intf *' are ABI compatible, hence no
> regular warning from -Wincompatible-function-pointer-types, the mismatch
> will trigger a kCFI violation when gbe_hwtstamp_get() or
> gbe_hwtstamp_set() are called indirectly. The types were updated for the
> CONFIG_TI_CPTS=y implementations but not the CONFIG_TI_CPTS=n ones.
> 
> Update the type of the first parameter in the CONFIG_TI_CPTS=n stubs to
> resolve the warning/CFI violation.
> 
> Fixes: 3f02b8272557 ("ti: netcp: convert to ndo_hwtstamp callbacks")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>   drivers/net/ethernet/ti/netcp_ethss.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
> index 0ae44112812c..4f6cc6cd1f03 100644
> --- a/drivers/net/ethernet/ti/netcp_ethss.c
> +++ b/drivers/net/ethernet/ti/netcp_ethss.c
> @@ -2755,13 +2755,13 @@ static inline void gbe_unregister_cpts(struct gbe_priv *gbe_dev)
>   {
>   }
>   
> -static inline int gbe_hwtstamp_get(struct gbe_intf *gbe_intf,
> +static inline int gbe_hwtstamp_get(void *intf_priv,
>   				   struct kernel_hwtstamp_config *cfg)
>   {
>   	return -EOPNOTSUPP;
>   }
>   
> -static inline int gbe_hwtstamp_set(struct gbe_intf *gbe_intf,
> +static inline int gbe_hwtstamp_set(void *intf_priv,
>   				   struct kernel_hwtstamp_config *cfg,
>   				   struct netlink_ext_ack *extack)
>   {
> 

Fair, netcp_module expects 'void *' type of the first parameter.

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

      reply	other threads:[~2025-11-08 12:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-08  3:19 [PATCH net-next] net: netcp: ethss: Fix type of first parameter in hwtstamp stubs Nathan Chancellor
2025-11-08 12:43 ` Vadim Fedorenko [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=01dbac10-fbe3-4211-bf8a-eb622df81f64@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=justinstitt@google.com \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=patches@lists.linux.dev \
    /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.