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 7CB5CECAAD8 for ; Tue, 13 Sep 2022 23:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbiIMXMs (ORCPT ); Tue, 13 Sep 2022 19:12:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiIMXMp (ORCPT ); Tue, 13 Sep 2022 19:12:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6144E70E43 for ; Tue, 13 Sep 2022 16:12:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2173CB81107 for ; Tue, 13 Sep 2022 23:12:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F147C433D6; Tue, 13 Sep 2022 23:12:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663110761; bh=As3E/5cVHJLb20FXFderpxKGHqSXrRunlE+X5ctrt8w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=klS7TgFo8gwWLAQxxz2ru+T8tfcS/nLmWqn//q7EReQUj/9yBnt4XG9w6/sW0AAnF k0gmaCvVa0PGaGSPASl3vvx9yhMHxhYGboCTQWVdzWpWakkrmtUOaBWVANvAYX7HwB /a/RwX3C5PS7tDhogxj5Ihtble/uKDcYqfsgyCZhRLr/6bNo1Gnpj1CWLzSKX9zzs8 y2u/qVFQdV7fqThAgA9eBqos0ofHe3SddlINXLqv9Jc+Iki8Zz8Jks10eT6NFc5Fml 8ILlX9xWgsPNMQnB6wvA4izBd0hfs7RgjC82QG/qNFKRJdb0+bfJtILPw0vWWgDEW2 hSCv+C+TvD9Aw== Date: Tue, 13 Sep 2022 16:12:39 -0700 From: Nathan Chancellor To: Nathan Huckleberry Cc: Dan Carpenter , llvm@lists.linux.dev, Larry Finger , Florian Schilhabel , Greg Kroah-Hartman , Nick Desaulniers , Tom Rix , Sathish Kumar , "Fabio M. De Francesco" , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8712: Fix return type of r8712_xmit_entry Message-ID: References: <20220912214607.929211-1-nhuck@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220912214607.929211-1-nhuck@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 12, 2022 at 02:46:03PM -0700, Nathan Huckleberry wrote: > 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 r8712_xmit_entry 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 The prototype in drivers/staging/rtl8712/xmit_osdep.h should be updated as well. With that: Reviewed-by: Nathan Chancellor > --- > drivers/staging/rtl8712/xmit_linux.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/rtl8712/xmit_linux.c b/drivers/staging/rtl8712/xmit_linux.c > index 4a93839bf947..e84b9fa231cd 100644 > --- a/drivers/staging/rtl8712/xmit_linux.c > +++ b/drivers/staging/rtl8712/xmit_linux.c > @@ -140,7 +140,7 @@ void r8712_xmit_complete(struct _adapter *padapter, struct xmit_frame *pxframe) > pxframe->pkt = NULL; > } > > -int r8712_xmit_entry(_pkt *pkt, struct net_device *netdev) > +netdev_tx_t r8712_xmit_entry(_pkt *pkt, struct net_device *netdev) > { > struct xmit_frame *xmitframe = NULL; > struct _adapter *adapter = netdev_priv(netdev); > @@ -165,11 +165,11 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *netdev) > } > xmitpriv->tx_pkts++; > xmitpriv->tx_bytes += xmitframe->attrib.last_txcmdsz; > - return 0; > + return NETDEV_TX_OK; > _xmit_entry_drop: > if (xmitframe) > r8712_free_xmitframe(xmitpriv, xmitframe); > xmitpriv->tx_drop++; > dev_kfree_skb_any(pkt); > - return 0; > + return NETDEV_TX_OK; > } > -- > 2.37.2.789.g6183377224-goog >