Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1471944rwj; Sun, 18 Dec 2022 08:50:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf7xQrplsGEuknvRKVd3RGgZUMXUdNbZv1ajivou6dlhlKNiL5sgjHrEK2DqWIMlQY8IOqsu X-Received: by 2002:a17:906:b0cb:b0:7ba:5d72:2f96 with SMTP id bk11-20020a170906b0cb00b007ba5d722f96mr20562601ejb.22.1671382248360; Sun, 18 Dec 2022 08:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671382248; cv=none; d=google.com; s=arc-20160816; b=WlGLcd0qW9F9pRaBOZa2Mo8GTRp1wwkBfaans5pU/KQCB5fiEF15ZmGQEYUaeqCZ99 ZoY9NiLqZkJYVh+TDbGgWFFAmnm4dGut+7AvWnTa3ZGu6NvrFnUTREWHGsFo6i+FNhkY lrduRKycodOPuxZ1Z5JKtftoX8vDWZwQw+IN/sEmkGmrD0pLOCHWDUe92xBOOzLedjFk RBPN7rJeP+d7HmWaYaXtWYCM1DMdSau75wwVzzMwjKn7ZZUVplK7gNb9dEhItJQNn4m3 OFfQQ49g+WCDe+78/imT6+u+gktRopAmTuZmnFpZ7SeYS03copW1eFcOJR6SOmbuaRWw Xt7g== 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=cxtPJyqBIAIEilW6TWBhE+GXzP+BncJeVGXS2I5AgVo=; b=P82lAfhkKCzNaNRd7dglEcORGpbkar39xnB/pvtMYCkg4CBgM0rXhN7ohkee7VgL9/ Hzsx3WMNLQI/CpPXSryNUny3bDbzEhKougzw5X+I7yqVSo4LM8z6aFTx0BbcL8vLQZ1M zO+2McqXHmPz47pTY5DtyDmmMvyQ/o1I9SyDRjRDNofC6wV6lcpAGSxysQafZx3wBU/E PAp0FeMkT3DmAsAMksxd6Wgl/I6euEb6wAjs0j4e6UZyNeU2Jr9/F6ErdIP2mr31BZj3 pjnnjbM1q95+HeqHHWF3uWnm0IVok+ZnTlF01wO8jyexEknAlp6dMDF1gyXOAiZ0XDuv UlBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rjPoh5un; 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 qa38-20020a17090786a600b00782539a0286si8325076ejc.142.2022.12.18.08.50.32; Sun, 18 Dec 2022 08:50:48 -0800 (PST) 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=rjPoh5un; 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 S232447AbiLRQlC (ORCPT + 70 others); Sun, 18 Dec 2022 11:41:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232441AbiLRQkR (ORCPT ); Sun, 18 Dec 2022 11:40:17 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84FA9186FC; Sun, 18 Dec 2022 08:14:14 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id 94EDBCE0BAE; Sun, 18 Dec 2022 16:14:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C8C3C433F2; Sun, 18 Dec 2022 16:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671380050; bh=XxQQLr0tUW5kW3XWYe6ahiX6YhC3EZPRsH+zK9vC2sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rjPoh5untmbea1voRoVNeo5hNmXSWNj8gJ30ORlFkxngeZfc50ooVoNQyNHd0k0j7 QTfrOHyM4hlIR2fkEmTRi37o2ppD+cAHwXsC6QyKZhosGWYTHFK8ouNm08FIowL678 Zb5e9qyVov+r+A4jB7utCNQ4D4tu8IBHSTw+CAm9kzW8wddYc6aUNWS7w1cTKwcsDz 987DB98PWkG1f7jzrvRyAE0+uCAFg19bEw032VxzR7UQPn+3eeQjkPCCaagBsZM047 Kza4F2lWM157RfTJADW4X7gvihhi9VC7AD9GD5/mVGfSMb7yPgBXX6HvgdJomcBAkc 71EPGoStbTi8g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , Alexandra Winter , Kees Cook , "David S . Miller" , Sasha Levin , wenjia@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, ndesaulniers@google.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH AUTOSEL 5.15 19/46] s390/netiucv: Fix return type of netiucv_tx() Date: Sun, 18 Dec 2022 11:12:17 -0500 Message-Id: <20221218161244.930785-19-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221218161244.930785-1-sashal@kernel.org> References: <20221218161244.930785-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: Nathan Chancellor [ Upstream commit 88d86d18d7cf7e9137c95f9d212bb9fff8a1b4be ] With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals: drivers/s390/net/netiucv.c:1854:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict] .ndo_start_xmit = netiucv_tx, ^~~~~~~~~~ ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of netiucv_tx() to match the prototype's to resolve the warning and potential CFI failure, should s390 select ARCH_SUPPORTS_CFI_CLANG in the future. Additionally, while in the area, remove a comment block that is no longer relevant. Link: https://github.com/ClangBuiltLinux/linux/issues/1750 Reviewed-by: Alexandra Winter Reviewed-by: Kees Cook Signed-off-by: Nathan Chancellor Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/s390/net/netiucv.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 5a0c2f07a3a2..ce5f0ffd6cc8 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c @@ -1252,15 +1252,8 @@ static int netiucv_close(struct net_device *dev) /** * Start transmission of a packet. * Called from generic network device layer. - * - * @param skb Pointer to buffer containing the packet. - * @param dev Pointer to interface struct. - * - * @return 0 if packet consumed, !0 if packet rejected. - * Note: If we return !0, then the packet is free'd by - * the generic network layer. */ -static int netiucv_tx(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t netiucv_tx(struct sk_buff *skb, struct net_device *dev) { struct netiucv_priv *privptr = netdev_priv(dev); int rc; -- 2.35.1