net: mana: Fix return type of mana_start_xmit
PATCH 1/1 net: mana: Fix return type of mana_start_xmit
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 mana_start_xmit should be changed from int to netdev_tx_t.
--- drivers/net/ethernet/microsoft/mana/mana_en.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microsoft/mana/mana_en.c +1 -1
@@ -128,7 +128,7 @@ static int mana_map_skb(struct sk_buff *skb, struct mana_port_context *apc,return -ENOMEM ; } -int mana_start_xmit (struct sk_buff *skb,struct net_device *ndev) +netdev_tx_t mana_start_xmit (struct sk_buff *skb,struct net_device *ndev) {enum mana_tx_pkt_format pkt_fmt =MANA_SHORT_PKT_FMT ;struct mana_port_context *apc =netdev_priv (ndev);
Signature · 1 line
2.37.2.789.g6183377224-goog
Quoted 9 lines
From: Nathan Huckleberry <[email protected]>
Sent: Monday, September 12, 2022 2:44 PM
...
Thendo_start_xmitfield innet_device_opsis expected to be of typenetdev_tx_t(*ndo_start_xmit)(structsk_buff*skb, structnet_device*dev).The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.
Quoted 7 lines
The return type of
mana_start_xmitshould be changed from int tonetdev_tx_t.Reported-by Dan Carpenter <[email protected]>Link ...Signed-off-by Nathan Huckleberry <[email protected]>
Thanks for the fix!
Jakub Kicinski
maintainerdrivers/net/ethernet/microsoft/mana/mana_en.c static int mana_map_skb(struct sk_buff *skb, struct mana_port_context *apc, · line 131
Quoted 2 lines · On Mon, 12 Sep 2022 14:43:53 -0700 Nathan Huckleberry wrote:
drivers/net/ethernet/microsoft/mana/mana_en.c +1
-1-int mana_start_xmit (struct sk_buff *skb,struct net_device *ndev) +netdev_tx_t mana_start_xmit (struct sk_buff *skb,struct net_device *ndev)
This one has a prototype.
PATCH v2 1/1 net: mana: Fix return type of mana_start_xmit
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 mana_start_xmit should be changed from int to netdev_tx_t.
---
Changes v1 -> v2
- Update header file
drivers/net/ethernet/microsoft/mana/mana_en.c | 2 +- include/net/mana/mana.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microsoft/mana/mana_en.c +1 -1
@@ -141,7 +141,7 @@ static int mana_map_skb(struct sk_buff *skb, struct mana_port_context *apc,return -ENOMEM ; } -int mana_start_xmit (struct sk_buff *skb,struct net_device *ndev) +netdev_tx_t mana_start_xmit (struct sk_buff *skb,struct net_device *ndev) {enum mana_tx_pkt_format pkt_fmt =MANA_SHORT_PKT_FMT ;struct mana_port_context *apc =netdev_priv (ndev);
include/net/mana/mana.h +1 -1
@@ -390,7 +390,7 @@ struct mana_port_context {struct mana_ethtool_stats eth_stats; }; -int mana_start_xmit (struct sk_buff *skb,struct net_device *ndev); +netdev_tx_t mana_start_xmit (struct sk_buff *skb,struct net_device *ndev);int mana_config_rss (struct mana_port_context *ac,enum TRI_STATE rx,bool update_hash,bool update_tab);
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
Jakub Kicinski
maintainerQuoted 1 line · On Thu, 29 Sep 2022 11:14:11 -0700 Nathan Huckleberry wrote:
include/net/mana/mana.h | 2 +-
This file does not exist in the net-next tree :S
Perhaps it was created when RDMA support was added?
Anyway, repost in a couple of weeks, it should all be straightened out after the merge window.