The validity verification of input parameters should be performed at
API layer, not in the PMD.
Fixes:
3a18c44b45df ("ethdev: add access to EEPROM")
Fixes:
40ff8b305ab8 ("net/e1000: add module EEPROM callbacks for e1000")
Fixes:
f2088e785cca ("net/i40e: fix dereference before check when getting EEPROM")
Fixes:
b74d0cd43e37 ("net/ixgbe: add module EEPROM callbacks for ixgbe")
Fixes:
8a6a09f853a0 ("net/mlx5: support reading module EEPROM data")
Fixes:
58f6f93c34c1 ("net/octeontx2: add module EEPROM dump")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
u16 first_word, last_word;
int i = 0;
- if (info->length == 0)
- return -EINVAL;
-
first_word = info->offset >> 1;
last_word = (info->offset + info->length - 1) >> 1;
uint32_t value = 0;
uint32_t i;
- if (!info || !info->length || !info->data)
- return -EINVAL;
-
if (hw->phy.link_info.module_type[0] == I40E_MODULE_TYPE_SFP)
is_sfp = true;
uint8_t *data = info->data;
uint32_t i = 0;
- if (info->length == 0)
- return -EINVAL;
-
for (i = info->offset; i < info->offset + info->length; i++) {
if (i < RTE_ETH_MODULE_SFF_8079_LEN)
status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte);
};
int ret = 0;
- if (!dev || !modinfo) {
+ if (!dev) {
DRV_LOG(WARNING, "missing argument, cannot get module info");
rte_errno = EINVAL;
return -rte_errno;
struct ifreq ifr;
int ret = 0;
- if (!dev || !info) {
+ if (!dev) {
DRV_LOG(WARNING, "missing argument, cannot get module eeprom");
rte_errno = EINVAL;
return -rte_errno;
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
struct cgx_fw_data *rsp;
- if (!info->data || !info->length ||
- (info->offset + info->length > SFP_EEPROM_SIZE))
+ if (info->offset + info->length > SFP_EEPROM_SIZE)
return -EINVAL;
rsp = nix_get_fwdata(dev);
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ if (modinfo == NULL)
+ return -EINVAL;
dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_info, -ENOTSUP);
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ if (info == NULL || info->data == NULL || info->length == 0)
+ return -EINVAL;
dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_eeprom, -ENOTSUP);
* - (0) if successful.
* - (-ENOTSUP) if hardware doesn't support.
* - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
* - (-EIO) if device is removed.
* - others depends on the specific operations implementation.
*/
* @return
* - (0) if successful.
* - (-ENOTSUP) if hardware doesn't support.
+ * - (-EINVAL) if bad parameter.
* - (-ENODEV) if *port_id* invalid.
* - (-EIO) if device is removed.
* - others depends on the specific operations implementation.