Merge branch 'small-fixes-for-mctp'

Matt Johnston says:

====================
Small fixes for MCTP

This series has 3 fixes for MCTP.
====================

Link: https://lore.kernel.org/r/20220225053938.643605-1-matt@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2022-02-25 22:23:36 -08:00
commit 3e120e4580
2 changed files with 8 additions and 7 deletions

View File

@ -338,7 +338,7 @@ static int mctp_i2c_recv(struct mctp_i2c_dev *midev)
if (status == NET_RX_SUCCESS) {
ndev->stats.rx_packets++;
ndev->stats.rx_bytes += skb->len;
ndev->stats.rx_bytes += recvlen;
} else {
ndev->stats.rx_dropped++;
}
@ -537,6 +537,9 @@ static int mctp_i2c_header_create(struct sk_buff *skb, struct net_device *dev,
struct mctp_hdr *mhdr;
u8 lldst, llsrc;
if (len > MCTP_I2C_MAXMTU)
return -EMSGSIZE;
lldst = *((u8 *)daddr);
llsrc = *((u8 *)saddr);
@ -547,8 +550,6 @@ static int mctp_i2c_header_create(struct sk_buff *skb, struct net_device *dev,
hdr->dest_slave = (lldst << 1) & 0xff;
hdr->command = MCTP_I2C_COMMANDCODE;
hdr->byte_count = len + 1;
if (hdr->byte_count > MCTP_I2C_MAXBLOCK)
return -EMSGSIZE;
hdr->source_slave = ((llsrc << 1) & 0xff) | 0x01;
mhdr->ver = 0x01;

View File

@ -428,10 +428,10 @@ static void mctp_unregister(struct net_device *dev)
struct mctp_dev *mdev;
mdev = mctp_dev_get_rtnl(dev);
if (mctp_known(dev) != (bool)mdev) {
if (mdev && !mctp_known(dev)) {
// Sanity check, should match what was set in mctp_register
netdev_warn(dev, "%s: mdev pointer %d but type (%d) match is %d",
__func__, (bool)mdev, mctp_known(dev), dev->type);
netdev_warn(dev, "%s: BUG mctp_ptr set for unknown type %d",
__func__, dev->type);
return;
}
if (!mdev)
@ -455,7 +455,7 @@ static int mctp_register(struct net_device *dev)
if (mdev) {
if (!mctp_known(dev))
netdev_warn(dev, "%s: mctp_dev set for unknown type %d",
netdev_warn(dev, "%s: BUG mctp_ptr set for unknown type %d",
__func__, dev->type);
return 0;
}