Skip to contentSkip to conversation

net: mana: Fix return type of mana_start_xmit

PATCH Superseded Nathan Huckleberry 3 participants 5 messages Sep 12, 2022 – Oct 3, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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
index 9259a74eca40..dfecef8c08e5 100644
@@ -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
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines

From: Nathan Huckleberry <[email protected]>
Sent: Monday, September 12, 2022 2:44 PM
...
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.

Quoted 7 lines

The return type of mana_start_xmit should be changed from int to netdev_tx_t.

Thanks for the fix!

maintainer
#2 lore raw
In reply to Nathan Huckleberry

drivers/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.

#3 lore raw

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
index 7ca313c7b7b3..a3df5678bb4f 100644
@@ -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
index 20212ffeefb9..3bb579962a14 100644
@@ -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
maintainer
#4 lore raw
Quoted 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.