From patchwork Thu Sep 29 18:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Huckleberry X-Patchwork-Id: 12994545 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46CE3C433FE for ; Thu, 29 Sep 2022 18:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hXNmatnNWDdbpiHqa/H/+EwjvDii3y3C4o7IZ/F2eok=; b=DDoLbViyI16/XLT8Bd4yNomPmm ytDk0XTmhsCStg1BEq/jBHhXLqRV1ULv2xZ4LfKGAilSPBtzdZ4DcJ/Zebwg6D72e6m5ged9Png+H 2pJ9N11xNhBJc5bfU5vfJZys/DzThyXKnQsjZ12gkR5usEmLHoXy+LA5XEgNWJci7exiDf5Xz/FKR cTlDndV4pKQ0LJGL4aMic3jH+Ko2n4PFjRJ9VIQyEjj9CdhSZxKcyw/dyKfKamCYbaegkO1IA9jr+ 1p7s59qkZUeBG0uUkZdZbxsH/zAxq4YKEayWiho5FE1yNU77rJMd3PnHY1P65VzVoa/jm8v9gOsqN JYMRyeUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ody8g-004tC5-AS; Thu, 29 Sep 2022 18:20:02 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ody8c-004t9m-Ko for linux-arm-kernel@lists.infradead.org; Thu, 29 Sep 2022 18:20:00 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-3547f988c19so21148067b3.9 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=7Exs75DgzC9MS2F1xqqunAWmKN3bLS5qbcKSClGtkvlnUnmqHJeqifImhg+9UbfdoC SgnxKNqKtiCfO6icbNfNFm2zSr/Au21I6QEFLyi2jhL6JIPcYo+tsv2X0D0wQxYf406X ZLtOE8yYaNK5J/wtAQ6jB1Hs4Eqk0dyOwyclToGyCT7Nmwv3QVH5tC9QK022WQFbh7vA rAEE/Ag2AsOeNej00NV8SicbBgaHyNTZSBGWhzfRoI7XK09Giqqrgwx+cWh+Kagxlgqd KCwocFv/n85jno387YeIOz1dwDN2DLvfKzOwn25ex2M9rvU1sVLPjwxdEEmq+pFkW9GE DIPQ== X-Gm-Message-State: ACrzQf2ZbhwCaF7NDXY9uDuVrs5laJzxjMJn6RsUO/dq1zKuWIzH6L5X AKJ5NDEzAp2HrXAcsaIonSENqVv1zw== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220929_111958_700795_C4DD4260 X-CRM114-Status: GOOD ( 13.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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);