From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D1C9C433FE for ; Thu, 29 Sep 2022 18:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235818AbiI2SUA (ORCPT ); Thu, 29 Sep 2022 14:20:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235771AbiI2STz (ORCPT ); Thu, 29 Sep 2022 14:19:55 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C221745F5B for ; Thu, 29 Sep 2022 11:19:53 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-354262a27c8so21323147b3.15 for ; Thu, 29 Sep 2022 11:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=SPo8cxe5Gv4Icg9WBrTrddqkcf882sEf/dI0Be8XuxM=; b=DXJnnm+NdL8nSanlq3PhzlVA2yW8T9I3mOa4xTvpj42zBvFu66FIb2DtQDOjHeG+6v HG3cK4hF922dwdGX+x8p7M6qxWMG+f6hDGB2TfxfIDs0H1DDPVDs5ZPI69y+pKxTDeMT SpO1i5Gshc3VpB6UyQQDsQzCy3FgY7GG6NVmJ647J6qtYhmcaVPt+8gNr+34nTwANlSa QbU/D0nreNEhATK9tXjmehbZPg/h6npv7o0zZWMdjdFVDdsBQQBUkwwgu0CxZL0FgOyG duIQJBBQvHvR4F1IfLZu86vzbPpr/r1yF9N17o8yLu1I88CUq0ClhnYOWb683aA7tvTM jwJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=SPo8cxe5Gv4Icg9WBrTrddqkcf882sEf/dI0Be8XuxM=; b=Eqhjpkpng6iGDLaqG0L25DmfGRMZWYp7u4Z8dVR6w2QPDpRKJ20qRoI9OanieGUV9R zuUEoi844izQzFcBw0C72dBXQ4gnH3m2K90r/md9N/rfnBHlPAJD+gUUoFgggm1ajNmb JxghVaIJ288M97JnY9uQHoDUMvVgks1h6D4lHBFVeTQiFKq3kcybnXO/ADr75RpyHGY0 gzOQZbcC5Emw1jU4gZHHs/n+vcZmkNjMWQcnFkotIwQ1tDA2Yv12Ovg8jteA4LF4HVHo xWAR0Klpo9DQ+z/ajxtBWk+zLVGbrivZchLFOOkpByYFEtTsyzDbPJriCCfCrkWsxTxK 4B2w== X-Gm-Message-State: ACrzQf2wPCA5zHaYXWWzy2L5Un9Nlk/5bzZzVnb5ktRCgFxfMFxMKxYY WeQHfBr6Dd8lTZRtpIx6Anl3zBSffA== X-Google-Smtp-Source: AMsMyM7hNJtv8eCYHU7H8bJzKkzWK1XeHZnh/Mh4XMITraHR5mnwjiEVoe7+u4ihdbWsT8jjcmHhOIx6uQ== X-Received: from nhuck.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:39cc]) (user=nhuck job=sendgmr) by 2002:a81:c45:0:b0:34d:21de:b794 with SMTP id 66-20020a810c45000000b0034d21deb794mr4937456ywm.138.1664475593080; Thu, 29 Sep 2022 11:19:53 -0700 (PDT) Date: Thu, 29 Sep 2022 11:19:47 -0700 In-Reply-To: <20220920073003.5dab2753@kernel.org> Mime-Version: 1.0 References: <20220920073003.5dab2753@kernel.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog Message-ID: <20220929181947.62909-1-nhuck@google.com> Subject: [PATCH v2] net: sparx5: Fix return type of sparx5_port_xmit_impl From: Nathan Huckleberry To: kuba@kernel.org Cc: Steen.Hegelund@microchip.com, UNGLinuxDriver@microchip.com, casper.casan@gmail.com, davem@davemloft.net, edumazet@google.com, error27@gmail.com, horatiu.vultur@microchip.com, lars.povlsen@microchip.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, nathan@kernel.org, ndesaulniers@google.com, netdev@vger.kernel.org, nhuck@google.com, pabeni@redhat.com, trix@redhat.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev). The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition. The return type of sparx5_port_xmit_impl should be changed from int to netdev_tx_t. Reported-by: Dan Carpenter Link: https://github.com/ClangBuiltLinux/linux/issues/1703 Cc: llvm@lists.linux.dev Signed-off-by: Nathan Huckleberry --- Changes v1 -> v2 - Updated header file drivers/net/ethernet/microchip/sparx5/sparx5_main.h | 2 +- drivers/net/ethernet/microchip/sparx5/sparx5_packet.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.h b/drivers/net/ethernet/microchip/sparx5/sparx5_main.h index 8b42cad0e49c..7a83222caa73 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.h +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.h @@ -305,7 +305,7 @@ struct frame_info { void sparx5_xtr_flush(struct sparx5 *sparx5, u8 grp); void sparx5_ifh_parse(u32 *ifh, struct frame_info *info); irqreturn_t sparx5_xtr_handler(int irq, void *_priv); -int sparx5_port_xmit_impl(struct sk_buff *skb, struct net_device *dev); +netdev_tx_t sparx5_port_xmit_impl(struct sk_buff *skb, struct net_device *dev); int sparx5_manual_injection_mode(struct sparx5 *sparx5); void sparx5_port_inj_timer_setup(struct sparx5_port *port); diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c b/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c index 21844beba72d..83c16ca5b30f 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c @@ -222,13 +222,13 @@ static int sparx5_inject(struct sparx5 *sparx5, return NETDEV_TX_OK; } -int sparx5_port_xmit_impl(struct sk_buff *skb, struct net_device *dev) +netdev_tx_t sparx5_port_xmit_impl(struct sk_buff *skb, struct net_device *dev) { struct net_device_stats *stats = &dev->stats; struct sparx5_port *port = netdev_priv(dev); struct sparx5 *sparx5 = port->sparx5; u32 ifh[IFH_LEN]; - int ret; + netdev_tx_t ret; memset(ifh, 0, IFH_LEN * 4); sparx5_set_port_ifh(ifh, port->portno); -- 2.38.0.rc1.362.ged0d419d3c-goog