[PATCH v2] sched: fix integer handling issue

Thomas Monjalon thomas at monjalon.net
Thu Feb 24 23:51:44 CET 2022


23/02/2022 19:13, Morten Brørup:
> > From: Megha Ajmera [mailto:megha.ajmera at intel.com]
> > Sent: Wednesday, 23 February 2022 18.37
> > 
> > Masking of core mask was incorrect. Instead of using 1U for shifting,
> > it
> > should be using 1LU as the result is assigned to uint64.
> > 
> > CID 375859: Potentially overflowing expression "1U << app_main_core"
> > with
> > type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit
> > arithmetic, and then used in a context that expects an expression of
> > type "uint64_t" (64 bits, unsigned).
> > 
> > Coverity issue: 375859
> > 
> > Signed-off-by: Megha Ajmera <megha.ajmera at intel.com>
> > ---
> > -		if (app_used_core_mask & (1u << app_main_core)) {
> > +		if (app_used_core_mask & (RTE_BIT64(app_main_core))) {
> 
> No need for parenthesis around RTE_BIT64(app_main_core).

Fixed while merging.

> Acked-by: Morten Brørup <mb at smartsharesystems.com>

Applied, thanks.




More information about the dev mailing list