Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp221358rwi; Wed, 12 Oct 2022 19:04:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xKxyatZei1xUSEWycU3dKTInFb1Xdc8eQceaFw+3qZbxIYMHKQOjxrFM0u8wgiSBvqTzr X-Received: by 2002:a17:906:9fc1:b0:761:9192:504f with SMTP id hj1-20020a1709069fc100b007619192504fmr24964757ejc.116.1665626685846; Wed, 12 Oct 2022 19:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665626685; cv=none; d=google.com; s=arc-20160816; b=SGL5h+ws6zYqaDYxN4+/6N5towI33P5GHsOoy55LD+x4ax8fXuSsNRZB0NXQB5x7sB i/62xP9c46oWmKZwI+BLolmp/JAp7h6nfz/NqxQXEOZtmHC/k0HCKppSjWtRy+3wbuMl EL9UTB8lk0tmKHWCwFhzFN97+6XM7GyzCITrUJEplVy7IP2RGJso5Bd1n0JqoxnPoYNJ RpWdCf9DUi5FEL2AQzXvAN3A/Au2PPKFpCs0RtKj1DxmhXwQR/X6gdJP8NdQvdl9iCZz LEcXpszeSUuX7QF6z0NypB96Io/Eo7Z2RwbGKYUxS5dLYHZ5CwYw0d5xFhVSbeq8hNU2 0vzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=15KcoWHO3hZXX3xtUy6pI5/tBYCBQrTyTLRm1agOONI=; b=Bb1xSq/1VDBlgQ6xpH3tx9uGSigtlVG19tAmgTbG/7goCDKGBKE+3SkDbcesv3ACA8 XDAxKgDKCBQ/3HgC9Sw6nix2nRdlCkJVi3G3moctiQSMkswMGHcm3uaLiLMDSf9eFGCd /5tiD5mDV8Gc0xNSCW4QYYl3wan3RaTfqWMiGNR406V3pR4UiQtwRgsvBn+bV6GErJSC ryKCiHVgrAFdWS6hWCB2RUpr5sdjfUFyMt99IJmTOQkY8MBrgi7zqYUcY620/NJH/IR7 0DS3DoKYzgciYR58yTV96zZI+Lcd5Rv/KsMzTTh7QE/MPE1MXJlzu+Pm6QxMXIysnaHU YyMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bD3oej40; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a17090640ca00b0078cbe9d08c6si14914166ejk.197.2022.10.12.19.04.20; Wed, 12 Oct 2022 19:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bD3oej40; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231419AbiJMBN3 (ORCPT + 99 others); Wed, 12 Oct 2022 21:13:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbiJMBMn (ORCPT ); Wed, 12 Oct 2022 21:12:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15E781CFE0; Wed, 12 Oct 2022 18:11:40 -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 85DC5B81CD1; Thu, 13 Oct 2022 00:22:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 333C5C433C1; Thu, 13 Oct 2022 00:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620523; bh=EVWTMBdrIl0rdooeaOXXeRpDIuBj92DVN5Ph5M/rTMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bD3oej40Y9Dv03cD+0BAwZ41pMjU1KsOLUMc9cnuMFjxbHPUYFJlXR6xLJQQ+F7wZ 9XENhCYhSwr/OR6Y5wf8R+iwBedu1bT15gF5KmQKKqCwvlp2wsEHW2eWMAyI/aLpKq 7Mh+7Q6e/lR0rXeJbCDFynA0q8erT+YMEXD92b/TmC+2V8M+qnU+esfhTTzxMcAUrx B2Qff8jRXd2MHAFhN/eH971A2CJeWGwcQL7O9bF367TFLQtm0IyAs4q3VuwImwP66D 8OGIHXRIBWR4uy4ycbqeCKw8PLtYgmfPOmHwd2n/gPKdOKnDwRWbsQa4pGH/vH4sh1 cYflAH34sQyDA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: GUO Zihua , Greg Kroah-Hartman , Sasha Levin , Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, skumark1902@gmail.com, fmdefrancesco@gmail.com, asif.kgauri@gmail.com, linux-staging@lists.linux.dev Subject: [PATCH AUTOSEL 5.15 11/47] staging: rtl8712: Fix return type for implementation of ndo_start_xmit Date: Wed, 12 Oct 2022 20:20:46 -0400 Message-Id: <20221013002124.1894077-11-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013002124.1894077-1-sashal@kernel.org> References: <20221013002124.1894077-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: GUO Zihua [ Upstream commit 307d343620e1fc7a6a2b7a1cdadb705532c9b6a5 ] CFI (Control Flow Integrity) is a safety feature allowing the system to detect and react should a potential control flow hijacking occurs. In particular, the Forward-Edge CFI protects indirect function calls by ensuring the prototype of function that is actually called matches the definition of the function hook. Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this would get cought out by CFI and cause a panic. Use enums from netdev_tx_t as return value instead, then change return type to netdev_tx_t. Signed-off-by: GUO Zihua Link: https://lore.kernel.org/r/20220905130230.11230-1-guozihua@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8712/xmit_linux.c | 6 +++--- drivers/staging/rtl8712/xmit_osdep.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8712/xmit_linux.c b/drivers/staging/rtl8712/xmit_linux.c index 90d34cf9d2ff..2ef56bbe5981 100644 --- a/drivers/staging/rtl8712/xmit_linux.c +++ b/drivers/staging/rtl8712/xmit_linux.c @@ -146,7 +146,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); @@ -171,11 +171,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; } diff --git a/drivers/staging/rtl8712/xmit_osdep.h b/drivers/staging/rtl8712/xmit_osdep.h index b76021b568f8..1ad42658c883 100644 --- a/drivers/staging/rtl8712/xmit_osdep.h +++ b/drivers/staging/rtl8712/xmit_osdep.h @@ -34,7 +34,7 @@ struct sta_xmit_priv; struct xmit_frame; struct xmit_buf; -int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev); +netdev_tx_t r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev); void r8712_SetFilter(struct work_struct *work); int r8712_xmit_resource_alloc(struct _adapter *padapter, struct xmit_buf *pxmitbuf); -- 2.35.1