Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7098355rwn; Tue, 13 Sep 2022 13:57:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR5/xvZS1m8HeL7kLg6BOtxxYzEtEVnMr+XSYyEHA417W3Ap2A1wu/N9fM+dDxYF6mjAKCyB X-Received: by 2002:a05:6402:493:b0:445:b5f0:7a0f with SMTP id k19-20020a056402049300b00445b5f07a0fmr27520072edv.120.1663102660572; Tue, 13 Sep 2022 13:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663102660; cv=none; d=google.com; s=arc-20160816; b=09Uk4ptoJR0hUkdpvQ9GVKJzpvSwOLdmVo/gD1rYQrweDiGMl7Xe3BDdD7jlLlRdPN gx/7WTeLy6ZpBQxgc07xOy316SKz8wRV/y7uknn6Ji+yjD7qrGsM7QH7rzZZSENAdoHP Ty2gIwm/7iOX+GiujvxoeIq0UZt9pXQ0R7ex/rQqdcaIiaB1eW2SVw+53I1GOTm0djvH FsMisp5h0zKIXg5TsDX+3FijOGBKIhS6p7NezHL+7lPMUohuaD+oGoNiDG3UTcDSahH9 UwSNXSya/8vwQH5wLh1S8bSOhb9CuM1WV9aiMbsJlpgKL69KfPRnFC9XLi1vQOpiiYWd LHpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sIW0jOj9f2zyE3XbbwArWS7yU2vU8DbR4RLobl61rlE=; b=LXr25OJM002M8BSfGvSUAnAfQSNpQ53A+fXsZmc83v6IItM+cvCsvl45FgspMoc017 ZNTfHP+I9SFx+IZ4ia70WOk4J4VbWLE1vffgLFtRhJIYdBuRqzdUu3lvTdSr1tI7/d7L 9F7LD8iZR8U7x5DKCXHVL+lF5BbIt2iYs/RMsUbivvnoQqEVLuwmGERTBBEFpLu/KOtk 7ipuwr7KEgmxD4TCAfG3jAFecuNorpTaIPPgXXt2ewnvRCz4fZHgamhpZhIBRXFc/Uid pjFYaTVNxwc7BGZNhATTUpRXU4DW3qCqFYXNp9aTXajJXwM2/QHL67hGD5nWpK/FVRFJ AXCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=W19uCO3p; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs38-20020a1709072d2600b007420947aa83si12853721ejc.193.2022.09.13.13.57.14; Tue, 13 Sep 2022 13:57:40 -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=@google.com header.s=20210112 header.b=W19uCO3p; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229632AbiIMUrx (ORCPT + 99 others); Tue, 13 Sep 2022 16:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiIMUrv (ORCPT ); Tue, 13 Sep 2022 16:47:51 -0400 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1850874CFF for ; Tue, 13 Sep 2022 13:47:50 -0700 (PDT) Received: by mail-qv1-xf32.google.com with SMTP id y9so10206970qvo.4 for ; Tue, 13 Sep 2022 13:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=sIW0jOj9f2zyE3XbbwArWS7yU2vU8DbR4RLobl61rlE=; b=W19uCO3pR1SMidtgHfI2O4k1qUJbea2ZLFaTiP0KGphrTeFlMLoWfLAqyba3T3gqeF dEFpxJsRqVtLXCtxqDzQAOGCVN0Yxq4ZqfxC/qRxDbdfDrlqUH1Bzl2ojo47NXaGoq4h oPGH9U3AupA0OVh9Ugk6917bb3ZPxCvjl2KRub1j+Gli78hK7lPmGJINicWKftGyVqsr Zk2rd/A2eL7/uqErExT8IoUOuj2yGO3M5HRHEGOtnkstq2NN5cHkAZ/lSd6R8ofmo9wH V9Vopl3ru4YRwy7gadCWVvNzNpIZJ/mqCBp03s5dEzKgccIJ1lcAz9BuW9po56qg4bz5 WxoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=sIW0jOj9f2zyE3XbbwArWS7yU2vU8DbR4RLobl61rlE=; b=P5ADKMTuUF65n685fBxpFW68SOzGe9wxSn8P5Fk11+rgZWMHTYDRIP065EJOVHLzn4 sPTTuWSNgPV+wA0VDv/3FnqAcOmfx8gmV023sY4KX0F4yKQ+MfIenZXhNugKz/bftqSx vo9jkAeZJ2AXmn7chyczoQp1ZjCF4sGobw3cCUwLTMjD5+20bhL1iqGbm4B0P4JLp7jA naqY5jpoONoHWl5LoSzQUvS0afFylBokmmierDC6BiNX7G2Tt8alnPRxpWkhTtQjYbQx RDRzZRu66eFCYW7Er0Dp6PMyqDm3+2YmOWEn5XValq5Xb4ZSo+16voMBqhFr+ADge49P WRuw== X-Gm-Message-State: ACgBeo3rytz3nAcumjN5H0zl6UJc3XO9g7pic3Hz6axJp+xGxGuoXIGw svNwo4DXsSXY+x3ioM+R11V7G66LFtLX431kNAXvPQ== X-Received: by 2002:ad4:5ce9:0:b0:49f:ee02:50c7 with SMTP id iv9-20020ad45ce9000000b0049fee0250c7mr28733575qvb.105.1663102069229; Tue, 13 Sep 2022 13:47:49 -0700 (PDT) MIME-Version: 1.0 References: <20220912214432.928989-1-nhuck@google.com> <20220913081548.gmngjwuagbt63j7h@wse-c0155> In-Reply-To: <20220913081548.gmngjwuagbt63j7h@wse-c0155> From: Nathan Huckleberry Date: Tue, 13 Sep 2022 13:46:00 -0700 Message-ID: Subject: Re: [PATCH] net: sparx5: Fix return type of sparx5_port_xmit_impl To: Casper Andersson Cc: Dan Carpenter , llvm@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Nathan Chancellor , Nick Desaulniers , Tom Rix , Horatiu Vultur , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Hey Casper, On Tue, Sep 13, 2022 at 1:15 AM Casper Andersson wrote: > > Hi, > > On 2022-09-12 14:44, 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 sparx5_port_xmit_impl should be changed from int to > > netdev_tx_t. > > I noticed that the functions that assign the return value inside > sparx5_port_xmit_impl also have return type int, which would ideally > also be changed. But a bigger issue might be that > sparx5_ptp_txtstamp_request and sparx5_inject (called inside > sparx5_port_xmit_impl) returns -EBUSY (-16), when they should return > NETDEV_TX_BUSY (16). If this is an issue then it also needs to be fixed. It's not clear to me what happens when returning an error vs NETDEV_TX_BUSY. The netdev_tx_t enum allows negative values, so returning an error might be valid. If anyone more familiar with this code has insight into why it's done like this, that'd be useful. The important bit here for me is changing the return type on the hooked function since the current code will cause panics. > > sparx5_fdma_xmit also has int return type, but always returns > NETDEV_TX_OK right now. > > Best Regards, > Casper > Thanks, Huck