netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Nathan Chancellor <nathan@kernel.org>,
	kernel@pengutronix.de,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, llvm@lists.linux.dev,
	patches@lists.linux.dev
Subject: Re: [PATCH] can: rockchip_canfd: fix return type of rkcanfd_start_xmit()
Date: Mon, 9 Sep 2024 15:35:46 +0100	[thread overview]
Message-ID: <20240909143546.GX2097826@kernel.org> (raw)
In-Reply-To: <20240909-arcane-practical-petrel-015d24-mkl@pengutronix.de>

On Mon, Sep 09, 2024 at 10:57:06AM +0200, Marc Kleine-Budde wrote:
> On 09.09.2024 09:44:48, Simon Horman wrote:
> > On Fri, Sep 06, 2024 at 01:26:41PM -0700, Nathan Chancellor wrote:
> > > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
> > > indirect call targets are validated against the expected function
> > > pointer prototype to make sure the call target is valid to help mitigate
> > > ROP attacks. If they are not identical, there is a failure at run time,
> > > which manifests as either a kernel panic or thread getting killed. A
> > > warning in clang aims to catch these at compile time, which reveals:
> > > 
> > >   drivers/net/can/rockchip/rockchip_canfd-core.c:770:20: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
> > >     770 |         .ndo_start_xmit = rkcanfd_start_xmit,
> > >         |                           ^~~~~~~~~~~~~~~~~~
> > > 
> > > ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of
> > > 'netdev_tx_t', not 'int' (although the types are ABI compatible). Adjust
> > > the return type of rkcanfd_start_xmit() to match the prototype's to
> > > resolve the warning.
> > > 
> > > Fixes: ff60bfbaf67f ("can: rockchip_canfd: add driver for Rockchip CAN-FD controller")
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > 
> > Thanks, I was able to reproduce this problem at build time
> > and that your patch addresses it.
> 
> FTR: the default clang in Debian unstable, clang-16.0.6 doesn't support
> this. With clang-20 from experimental it works, haven't checked older
> versions, though.

FTR: I checked using 18.1.8 from here [1][2].

[1] https://mirrors.edge.kernel.org/pub/tools/llvm/
[2] https://mirrors.edge.kernel.org/pub/tools/llvm/files/



  reply	other threads:[~2024-09-09 14:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 20:26 [PATCH] can: rockchip_canfd: fix return type of rkcanfd_start_xmit() Nathan Chancellor
2024-09-09  7:14 ` Marc Kleine-Budde
2024-09-09  8:44 ` Simon Horman
2024-09-09  8:57   ` Marc Kleine-Budde
2024-09-09 14:35     ` Simon Horman [this message]
2024-09-10  9:56       ` Marc Kleine-Budde
2024-09-10 19:05         ` Nathan Chancellor
2024-09-11  8:18           ` Marc Kleine-Budde
2024-09-09 15:27     ` Nathan Chancellor

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=20240909143546.GX2097826@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=heiko@sntech.de \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=nathan@kernel.org \
    --cc=netdev@vger.kernel.org \
    --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 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).