The following issues were found
drivers/net/ethernet/intel/igc/igc_nvm.c
2 issues
Line: 168
Column: 25
CWE codes:
120
20
s32 ret_val = 0;
for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
if (ret_val) {
hw_dbg("NVM Read Error\n");
goto out;
}
checksum += nvm_data;
Reported by FlawFinder.
Line: 201
Column: 25
CWE codes:
120
20
s32 ret_val;
for (i = 0; i < NVM_CHECKSUM_REG; i++) {
ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
if (ret_val) {
hw_dbg("NVM Read Error while updating checksum.\n");
goto out;
}
checksum += nvm_data;
Reported by FlawFinder.
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.h
2 issues
Line: 32
Column: 11
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
struct mlxsw_sp_span_parms {
struct mlxsw_sp_port *dest_port; /* NULL for unoffloaded SPAN. */
unsigned int ttl;
unsigned char dmac[ETH_ALEN];
unsigned char smac[ETH_ALEN];
union mlxsw_sp_l3addr daddr;
union mlxsw_sp_l3addr saddr;
u16 vid;
u16 policer_id;
Reported by FlawFinder.
Line: 33
Column: 11
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
struct mlxsw_sp_port *dest_port; /* NULL for unoffloaded SPAN. */
unsigned int ttl;
unsigned char dmac[ETH_ALEN];
unsigned char smac[ETH_ALEN];
union mlxsw_sp_l3addr daddr;
union mlxsw_sp_l3addr saddr;
u16 vid;
u16 policer_id;
bool policer_enable;
Reported by FlawFinder.
drivers/net/ethernet/micrel/ks8851_spi.c
2 issues
Line: 184
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (ret < 0)
netdev_err(ks->netdev, "read: spi_sync() failed\n");
else if (kss->spidev->master->flags & SPI_MASTER_HALF_DUPLEX)
memcpy(rxb, trx, rxl);
else
memcpy(rxb, trx + 2, rxl);
}
/**
Reported by FlawFinder.
Line: 186
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
else if (kss->spidev->master->flags & SPI_MASTER_HALF_DUPLEX)
memcpy(rxb, trx, rxl);
else
memcpy(rxb, trx + 2, rxl);
}
/**
* ks8851_rdreg16_spi - read 16 bit register from device via SPI
* @ks: The chip information
Reported by FlawFinder.
drivers/net/ethernet/intel/igc/igc_base.h
2 issues
Line: 17
Column: 4
CWE codes:
120
20
__le64 buffer_addr; /* Address of descriptor's data buf */
__le32 cmd_type_len;
__le32 olinfo_status;
} read;
struct {
__le64 rsvd; /* Reserved */
__le32 nxtseq_seed;
__le32 status;
} wb;
Reported by FlawFinder.
drivers/net/ethernet/microchip/lan743x_main.c
2 issues
Line: 694
Column: 58
CWE codes:
120
20
return 0;
}
static u32 lan743x_mac_mii_access(u16 id, u16 index, int read)
{
u32 ret;
ret = (id << MAC_MII_ACC_PHY_ADDR_SHIFT_) &
MAC_MII_ACC_PHY_ADDR_MASK_;
Reported by FlawFinder.
Line: 703
Column: 6
CWE codes:
120
20
ret |= (index << MAC_MII_ACC_MIIRINDA_SHIFT_) &
MAC_MII_ACC_MIIRINDA_MASK_;
if (read)
ret |= MAC_MII_ACC_MII_READ_;
else
ret |= MAC_MII_ACC_MII_WRITE_;
ret |= MAC_MII_ACC_MII_BUSY_;
Reported by FlawFinder.
drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
2 issues
Line: 1201
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
int sparx_stats_init(struct sparx5 *sparx5)
{
char queue_name[32];
int portno;
sparx5->stats_layout = sparx5_stats_layout;
sparx5->num_stats = spx5_stats_count;
sparx5->num_ethtool_stats = ARRAY_SIZE(sparx5_stats_layout);
Reported by FlawFinder.
Line: 1015
Column: 3
CWE codes:
120
return;
for (idx = 0; idx < sparx5->num_ethtool_stats; idx++)
strncpy(data + idx * ETH_GSTRING_LEN,
sparx5->stats_layout[idx], ETH_GSTRING_LEN);
}
static void sparx5_get_sset_data(struct net_device *ndev,
struct ethtool_stats *stats, u64 *data)
Reported by FlawFinder.
drivers/net/ethernet/intel/igc/igc.h
2 issues
Line: 229
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
struct timespec64 prev_ptp_time; /* Pre-reset PTP clock */
ktime_t ptp_reset_start; /* Reset time in clock mono */
char fw_version[32];
struct bpf_prog *xdp_prog;
bool pps_sys_wrap_on;
Reported by FlawFinder.
Line: 471
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
struct napi_struct napi;
struct rcu_head rcu; /* to avoid race with update stats on free */
char name[IFNAMSIZ + 9];
struct net_device poll_dev;
/* for dynamic allocation of rings associated with this q_vector */
struct igc_ring ring[] ____cacheline_internodealigned_in_smp;
};
Reported by FlawFinder.
drivers/net/ethernet/microsoft/mana/hw_channel.c
2 issues
Line: 74
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
ctx->status_code = resp_msg->status;
memcpy(ctx->output_buf, resp_msg, resp_len);
out:
ctx->error = err;
complete(&ctx->comp_event);
}
Reported by FlawFinder.
Line: 811
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
req_msg = (struct gdma_req_hdr *)tx_wr->buf_va;
if (req)
memcpy(req_msg, req, req_len);
req_msg->req.hwc_msg_id = msg_id;
tx_wr->msg_size = req_len;
Reported by FlawFinder.
drivers/net/ethernet/microsoft/mana/mana_en.c
2 issues
Line: 586
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
req->default_rxobj = apc->default_rxobj;
if (update_key)
memcpy(&req->hashkey, apc->hashkey, MANA_HASH_KEY_SIZE);
if (update_tab) {
req_indir_tab = (mana_handle_t *)(req + 1);
memcpy(req_indir_tab, apc->rxobj_table,
req->num_indir_entries * sizeof(mana_handle_t));
Reported by FlawFinder.
Line: 590
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (update_tab) {
req_indir_tab = (mana_handle_t *)(req + 1);
memcpy(req_indir_tab, apc->rxobj_table,
req->num_indir_entries * sizeof(mana_handle_t));
}
err = mana_send_request(apc->ac, req, req_buf_size, &resp,
sizeof(resp));
Reported by FlawFinder.
drivers/net/ethernet/moxa/moxart_ether.c
2 issues
Line: 68
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (!is_valid_ether_addr(address->sa_data))
return -EADDRNOTAVAIL;
memcpy(ndev->dev_addr, address->sa_data, ndev->addr_len);
moxart_update_mac_address(ndev);
return 0;
}
Reported by FlawFinder.
Line: 255
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
goto rx_next;
}
memcpy(skb->data, priv->rx_buf[rx_head], len);
skb_put(skb, len);
skb->protocol = eth_type_trans(skb, ndev);
napi_gro_receive(&priv->napi, skb);
rx++;
Reported by FlawFinder.