Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp135491rwi; Wed, 12 Oct 2022 17:22:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vT82dSAthC1WpOstzbbB7BM8EzUNUmP3Rt2Gm6e7KgEWz3kqbVNS16N9iFudKnrkL1y3s X-Received: by 2002:a17:907:1623:b0:78d:9e8b:171d with SMTP id hb35-20020a170907162300b0078d9e8b171dmr17745831ejc.309.1665620558336; Wed, 12 Oct 2022 17:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665620558; cv=none; d=google.com; s=arc-20160816; b=xSJMkLKCbZ5asUTyFy00cXze/BRQzXRgeG1JHbncHYTt4KWm2ggO5F+X75lCNIouSL Ekg7mWabJbqfqh6DnYFzOK9RYa08WTtMSmzMM3vhj1s9Qebs17QpyM1ecwiKGIyx8Cy4 HqMui02B0M6hwMSiUUX1vMfM+PMAP5iGzIEFtKrk1bHB1KCc4t2vSRd+wtU2VkO6Wfdf tEn/E3hYPJfgY/G2kP6JWEsVHgUZmNEvSrcbc8SeVVMxN320xPYdtThtDDGf5Re/VYo9 IZf/5dbYeO5lOXqy8sboiQgNmgVSUa6sQ5TB+2a4xrksDXT0+w0FCWM10qhhESPn+hRV uFlw== 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=BM8xacu+QKCSg6MUwNuAJbERhoI2Iz5ktsCKNkTpOvg=; b=qivuyjmQHngI5gbeo6Qb00tF7DmOGGjwb4xIZfZ2+1UbX8bj59T3MiLf18/+hxml/E 9ZhCDmsw5fKgKcCkfxrZpl5jUitVBnqLwFa3DebmYLTsoa8JxeLjhcdP+nAvCTd/uI8c /RelSoB+8oGVN/LagEnONcLoG63OzWteOK62wrLZLs1ePLVBdWpwpZwhLG5Qw08sYvtD HReWs0EYW6OOsSr2mQdsAPDzUAtCYUCrybVYpbf9C4RRpxxLqpIHe2c53M4lEMzu2rOu qxLEO4Pk68PYmWEwkgIsv2OS9TdFoawWpApyZITQFVXLJcANCGt1sqaaCoGBDoXueEIZ mO7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hsy5lzFO; 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 l18-20020a056402255200b00459f2befc4esi16476934edb.354.2022.10.12.17.21.46; Wed, 12 Oct 2022 17:22:38 -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=Hsy5lzFO; 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 S229693AbiJMARe (ORCPT + 99 others); Wed, 12 Oct 2022 20:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229941AbiJMARN (ORCPT ); Wed, 12 Oct 2022 20:17:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AB9018C951; Wed, 12 Oct 2022 17:16:41 -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 5876AB81C48; Thu, 13 Oct 2022 00:16:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC23EC433D7; Thu, 13 Oct 2022 00:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620193; bh=KpnnWPP1OE+ebkDCcqGFFLm7Mvkg7iBOomUlwMr6yc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hsy5lzFOMGLcRxkiFcMQZVtDuRgTPbz4kQH6kzAMCq8GJ21Ga+zXuRv679o7Efsqf uxoiko5gC8jHi9/m+DIGouZaYrkLD30L6aNl5/QQSYkojtrXU1L+thiMdrSfKrFreE MUXmUTaUWQU6le5IPiYvaq6fM7T1a4pQzLZYhRkZBWALjr7WTJsXbRfP+Xb++8U6f6 cazDA+Mr1zV5bd1ld2KJ+AbiC46c40e6MJHNfjrlR9G12c7+K4jggi27nTRFEi7RAb YU4xGNnpYr+nWRUG34cIAzzNTBIrWy9dcb2JEjiKLy/EG2/9d7Jbkboa65WaLQ9XUw aJRzOSizpW0Kg== 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 6.0 15/67] staging: rtl8712: Fix return type for implementation of ndo_start_xmit Date: Wed, 12 Oct 2022 20:14:56 -0400 Message-Id: <20221013001554.1892206-15-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013001554.1892206-1-sashal@kernel.org> References: <20221013001554.1892206-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 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; } 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