The following issues were found
drivers/net/ethernet/smsc/smc9194.h
2 issues
Line: 165
Column: 14
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
#define CHIP_9195 5
#define CHIP_91100 7
static const char * chip_ids[ 15 ] = {
NULL, NULL, NULL,
/* 3 */ "SMC91C90/91C92",
/* 4 */ "SMC91C94",
/* 5 */ "SMC91C95",
NULL,
Reported by FlawFinder.
Line: 195
Column: 14
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
#define RS_MULTICAST 0x0001
#define RS_ERRORS (RS_ALGNERR | RS_BADCRC | RS_TOOLONG | RS_TOOSHORT)
static const char * interfaces[ 2 ] = { "TP", "AUI" };
/*-------------------------------------------------------------------------
. I define some macros to make it easier to do somewhat common
. or slightly complicated, repeated tasks.
--------------------------------------------------------------------------*/
Reported by FlawFinder.
drivers/net/ethernet/smsc/smc91x.c
2 issues
Line: 310
SMC_SET_TCR(lp, TCR_CLEAR);
SMC_SELECT_BANK(lp, 1);
ctl = SMC_GET_CTL(lp) | CTL_LE_ENABLE;
/*
* Set the control register to automatically release successfully
* transmitted packets, to make the best use out of our limited
* memory
Reported by Cppcheck.
Line: 1370
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 smc_local *lp = netdev_priv(dev);
void __iomem *ioaddr = lp->base;
unsigned char multicast_table[8];
int update_multicast = 0;
DBG(2, dev, "%s\n", __func__);
if (dev->flags & IFF_PROMISC) {
Reported by FlawFinder.
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
2 issues
Line: 138
CWE codes:
562
init.parent_data = parents;
init.num_parents = num_parents;
hw->init = &init;
return devm_clk_register(dwmac->dev, hw);
}
static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac)
Reported by Cppcheck.
Line: 127
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 clk_hw *hw)
{
struct clk_init_data init = { };
char clk_name[32];
snprintf(clk_name, sizeof(clk_name), "%s#%s", dev_name(dwmac->dev),
name_suffix);
init.name = clk_name;
Reported by FlawFinder.
drivers/net/ethernet/stmicro/stmmac/hwif.h
2 issues
Line: 606
Column: 9
CWE codes:
120
20
struct stmmac_mmc_ops {
void (*ctrl)(void __iomem *ioaddr, unsigned int mode);
void (*intr_all_mask)(void __iomem *ioaddr);
void (*read)(void __iomem *ioaddr, struct stmmac_counters *mmc);
};
#define stmmac_mmc_ctrl(__priv, __args...) \
stmmac_do_void_callback(__priv, mmc, ctrl, __args)
#define stmmac_mmc_intr_all_mask(__priv, __args...) \
Reported by FlawFinder.
Line: 614
Column: 39
CWE codes:
120
20
#define stmmac_mmc_intr_all_mask(__priv, __args...) \
stmmac_do_void_callback(__priv, mmc, intr_all_mask, __args)
#define stmmac_mmc_read(__priv, __args...) \
stmmac_do_void_callback(__priv, mmc, read, __args)
struct stmmac_regs_off {
u32 ptp_off;
u32 mmc_off;
};
Reported by FlawFinder.
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
2 issues
Line: 251
Column: 38
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
* corrected clock values in ns.
**/
static int stmmac_get_syncdevicetime(ktime_t *device,
struct system_counterval_t *system,
void *ctx)
{
struct stmmac_priv *priv = (struct stmmac_priv *)ctx;
if (priv->plat->crosststamp)
Reported by FlawFinder.
Line: 257
Column: 42
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
struct stmmac_priv *priv = (struct stmmac_priv *)ctx;
if (priv->plat->crosststamp)
return priv->plat->crosststamp(device, system, ctx);
else
return -EOPNOTSUPP;
}
static int stmmac_getcrosststamp(struct ptp_clock_info *ptp,
Reported by FlawFinder.
drivers/net/ethernet/intel/ice/ice_arfs.c
2 issues
Line: 333
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
fltr_info->flow_type = (ip_proto == IPPROTO_TCP) ?
ICE_FLTR_PTYPE_NONF_IPV6_TCP :
ICE_FLTR_PTYPE_NONF_IPV6_UDP;
memcpy(&fltr_info->ip.v6.src_ip, &fk->addrs.v6addrs.src,
sizeof(struct in6_addr));
memcpy(&fltr_info->ip.v6.dst_ip, &fk->addrs.v6addrs.dst,
sizeof(struct in6_addr));
fltr_info->ip.v6.src_port = fk->ports.src;
fltr_info->ip.v6.dst_port = fk->ports.dst;
Reported by FlawFinder.
Line: 335
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
ICE_FLTR_PTYPE_NONF_IPV6_UDP;
memcpy(&fltr_info->ip.v6.src_ip, &fk->addrs.v6addrs.src,
sizeof(struct in6_addr));
memcpy(&fltr_info->ip.v6.dst_ip, &fk->addrs.v6addrs.dst,
sizeof(struct in6_addr));
fltr_info->ip.v6.src_port = fk->ports.src;
fltr_info->ip.v6.dst_port = fk->ports.dst;
}
Reported by FlawFinder.
drivers/net/ethernet/sun/sungem.c
2 issues
Line: 2440
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (!is_valid_ether_addr(macaddr->sa_data))
return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len);
/* We'll just catch it later when the device is up'd or resumed */
if (!netif_running(dev) || !netif_device_present(dev))
return 0;
Reported by FlawFinder.
Line: 2800
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return -1;
#endif
}
memcpy(dev->dev_addr, addr, ETH_ALEN);
#else
get_gem_mac_nonobp(gp->pdev, gp->dev->dev_addr);
#endif
return 0;
}
Reported by FlawFinder.
drivers/net/ethernet/intel/ice/ice.h
2 issues
Line: 380
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
cpumask_t affinity_mask;
struct irq_affinity_notify affinity_notify;
char name[ICE_INT_NAME_STR_LEN];
u16 total_events; /* net_dim(): number of interrupts processed */
} ____cacheline_internodealigned_in_smp;
enum ice_pf_flags {
Reported by FlawFinder.
Line: 494
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
u32 tx_timeout_count;
unsigned long tx_timeout_last_recovery;
u32 tx_timeout_recovery_level;
char int_name[ICE_INT_NAME_STR_LEN];
struct auxiliary_device *adev;
int aux_idx;
u32 sw_int_count;
__le64 nvm_phy_type_lo; /* NVM PHY type low */
Reported by FlawFinder.
drivers/net/ethernet/sun/sunvnet.c
2 issues
Line: 82
Column: 8
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
}
static const struct {
const char string[ETH_GSTRING_LEN];
} ethtool_stats_keys[] = {
{ "rx_packets" },
{ "tx_packets" },
{ "rx_bytes" },
{ "tx_bytes" },
Reported by FlawFinder.
Line: 121
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
switch (stringset) {
case ETH_SS_STATS:
memcpy(buf, ðtool_stats_keys, sizeof(ethtool_stats_keys));
p += sizeof(ethtool_stats_keys);
rcu_read_lock();
list_for_each_entry_rcu(port, &vp->port_list, list) {
snprintf(p, ETH_GSTRING_LEN, "p%u.%s-%pM",
Reported by FlawFinder.
drivers/net/ethernet/synopsys/dwc-xlgmac-ethtool.c
2 issues
Line: 26
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
#include "dwc-xlgmac-reg.h"
struct xlgmac_stats_desc {
char stat_string[ETH_GSTRING_LEN];
int stat_offset;
};
#define XLGMAC_STAT(str, var) \
{ \
Reported by FlawFinder.
Line: 201
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
switch (stringset) {
case ETH_SS_STATS:
for (i = 0; i < XLGMAC_STATS_COUNT; i++) {
memcpy(data, xlgmac_gstring_stats[i].stat_string,
ETH_GSTRING_LEN);
data += ETH_GSTRING_LEN;
}
break;
default:
Reported by FlawFinder.