cast unsigned int ports_per_retimer, unsigned int nums_retimer,
unsigned int nums_fvl and unsigned int ports_per_fvl to uint64_t
before multiply operation, to avoid Unintentional integer overflow.
Coverity issue: 337924, 337926
Fixes: d1cd4eb2d48e ("raw/ifpga: support ipn3ke")
Cc: stable@dpdk.org
Signed-off-by: Andy Pei <andy.pei@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
if (!strcmp(attr_name, "LineSideLinkPortNum")) {
if (opae_manager_get_retimer_info(mgr, &opae_rtm_info))
return -1;
- uint64_t tmp = opae_rtm_info.ports_per_retimer *
- opae_rtm_info.nums_retimer;
+ uint64_t tmp = (uint64_t)opae_rtm_info.ports_per_retimer *
+ (uint64_t)opae_rtm_info.nums_retimer;
*attr_value = tmp;
return 0;
}
if (!strcmp(attr_name, "NICSideLinkPortNum")) {
if (opae_manager_get_retimer_info(mgr, &opae_rtm_info))
return -1;
- uint64_t tmp = opae_rtm_info.nums_fvl *
- opae_rtm_info.ports_per_fvl;
+ uint64_t tmp = (uint64_t)opae_rtm_info.nums_fvl *
+ (uint64_t)opae_rtm_info.ports_per_fvl;
*attr_value = tmp;
return 0;
}