Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp170218rwi; Wed, 2 Nov 2022 10:31:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dJUy0f0eNAxhw7GlolwZAHCpXgoKuFgOh1x3ikiIcTAgVxlXwNvXyZeOu/bEfTb/kVVCX X-Received: by 2002:a17:90b:1041:b0:213:1d13:aba2 with SMTP id gq1-20020a17090b104100b002131d13aba2mr45075770pjb.154.1667410277596; Wed, 02 Nov 2022 10:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667410277; cv=none; d=google.com; s=arc-20160816; b=FbpYcL2UxKF4jAvX4lA9JAv6lijh7BMMJk+k7HuPP1z5LuhMkupwyW3dWB3EKO50GT NL8AvyAVRE1hne6yFyjr+ww4FwO/Y9gdaNWr+WABQ9o1mJe8j6LBLz6fwN4cgOuh3vOw ubSPeQ7OSYdKzyUiK/tU4zcEMIxxb+a1focYRyUz16ohuN9fB+UkLv32Q8MOmXr71brQ 5zh7BHPvHmkQstAeaGMQ2neZn+bbfJWQpDSLlOPK9lljEedswrpyFDjqJwQyKoTzsJxw vMxaedWw5/SnaMiNL6tnCpUtVduitGKxMmfcHWgt66HIupEPABpcRmWkh1zMNRPWpkQc Rx/w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Uvvmbr50zna//Xb+fO5k+L/6McYtPqnoEtae1ZaNJuc=; b=TWK7sc4FD6zMAb5XZagaMbVZL0db3RPYjry/VnBSsYbVdhVWd1B9XJtwL03YdXC62f LVXbLVNE9YZphBnsr7x13q6KLy+Po/qohM55sTVBUU/4KfjkzgF7UCGlayMgiHNdcr9u +E72ksyicXAwIhZC+vIYzNgj5NXFLolHDJEwtYDUbQYNKByOF06EzpXhtELYeIZpRnyi 0co0u4f5KT4wJHAAhTLZjsZBhOT4pE5raQ1/TvHbT/nHv2R82BfWEEzd+knKLOEbglE2 3sJfu6ezwSzFjWMsGl0egQhC8l4pkLPsNOWHD7Yy4j3VYF2X7e9H0IgJxG59TNsqwBH5 RuMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qbRk6eCB; 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 q8-20020a17090311c800b001769b63ec65si20317610plh.483.2022.11.02.10.31.00; Wed, 02 Nov 2022 10:31:17 -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=qbRk6eCB; 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 S230005AbiKBQG0 (ORCPT + 98 others); Wed, 2 Nov 2022 12:06:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbiKBQGY (ORCPT ); Wed, 2 Nov 2022 12:06:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F37D25EB4; Wed, 2 Nov 2022 09:06:22 -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 dfw.source.kernel.org (Postfix) with ESMTPS id E3A2E6158D; Wed, 2 Nov 2022 16:06:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F660C433C1; Wed, 2 Nov 2022 16:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667405181; bh=uC/huKB8ojZr8E05891PDIL9GMzoWr5Ol6Vawz7NAHA=; h=From:To:Cc:Subject:Date:From; b=qbRk6eCBhBWgx0CQOO8Ik3q+htKp2pOYraMX06ybmCfSfqt/k/glkH97uTHhjR0M6 hcGl8TwcwSEkKCclmwA+UvEd0fxu/Q+nq0yIqgPoMzz44jRTlrU3KiD3Lfh5AaGsSg AYsmL3hr5pyJBOQQlncDwfP36xRqSCg5hYB+cOiUUcF4dSZ59FBpN4vv43478FM6kk Vk2piNjs/G9UgECa0gQIiO4dZk6bIz4cGlIDiJWEGzGqpM20K9TjtVWgun7EVKBBjq swIQumGh12Wn9Bt5g/0FQlavdScVCqIdG5UM/M1wtcK84sqR2JCyArpj6QTUsk3str Zt28kbB47Q4JA== From: Nathan Chancellor To: Thomas Sailer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-hams@vger.kernel.org, netdev@vger.kernel.org, Nick Desaulniers , Tom Rix , Kees Cook , Sami Tolvanen , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Nathan Chancellor Subject: [PATCH] hamradio: baycom_epp: Fix return type of baycom_send_packet() Date: Wed, 2 Nov 2022 09:06:10 -0700 Message-Id: <20221102160610.1186145-1-nathan@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.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 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/net/hamradio/baycom_epp.c:1119:25: 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 = baycom_send_packet, ^~~~~~~~~~~~~~~~~~ 1 error generated. ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of baycom_send_packet() to match the prototype's to resolve the warning and CFI failure. Link: https://github.com/ClangBuiltLinux/linux/issues/1750 Signed-off-by: Nathan Chancellor --- drivers/net/hamradio/baycom_epp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 791b4a53d69f..bd3b0c2655a2 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c @@ -758,7 +758,7 @@ static void epp_bh(struct work_struct *work) * ===================== network driver interface ========================= */ -static int baycom_send_packet(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t baycom_send_packet(struct sk_buff *skb, struct net_device *dev) { struct baycom_state *bc = netdev_priv(dev); base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780 -- 2.38.1