Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Serge Semin
On Tue, Dec 05, 2017 at 01:08:44PM -0500, Jon Mason wrote: > On Tue, Dec 5, 2017 at 12:56 PM, Serge Semin wrote: > > On Tue, Dec 05, 2017 at 11:52:32AM -0500, Jon Mason > > wrote: > >> On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Serge Semin
On Tue, Dec 05, 2017 at 01:08:44PM -0500, Jon Mason wrote: > On Tue, Dec 5, 2017 at 12:56 PM, Serge Semin wrote: > > On Tue, Dec 05, 2017 at 11:52:32AM -0500, Jon Mason > > wrote: > >> On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin > >> wrote: > >> > Simple (1 << pidx) operation causes

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Jon Mason
On Tue, Dec 5, 2017 at 12:56 PM, Serge Semin wrote: > On Tue, Dec 05, 2017 at 11:52:32AM -0500, Jon Mason wrote: >> On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: >> > Simple (1 << pidx) operation causes undefined behaviour

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Jon Mason
On Tue, Dec 5, 2017 at 12:56 PM, Serge Semin wrote: > On Tue, Dec 05, 2017 at 11:52:32AM -0500, Jon Mason wrote: >> On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: >> > Simple (1 << pidx) operation causes undefined behaviour when >> > pidx >= 32. It must be casted to u64 to match the actual

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Serge Semin
On Tue, Dec 05, 2017 at 11:52:32AM -0500, Jon Mason wrote: > On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: > > Simple (1 << pidx) operation causes undefined behaviour when > > pidx >= 32. It must be casted to u64 to match the actual return > >

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Serge Semin
On Tue, Dec 05, 2017 at 11:52:32AM -0500, Jon Mason wrote: > On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: > > Simple (1 << pidx) operation causes undefined behaviour when > > pidx >= 32. It must be casted to u64 to match the actual return > > value of ntb_link_is_up() method, so to have

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Jon Mason
On Tue, Dec 5, 2017 at 12:01 PM, Logan Gunthorpe wrote: > > > On 05/12/17 09:52 AM, Jon Mason wrote: >> >> On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin >> wrote: >>> >>> Simple (1 << pidx) operation causes undefined behaviour when >>> pidx >= 32. It

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Jon Mason
On Tue, Dec 5, 2017 at 12:01 PM, Logan Gunthorpe wrote: > > > On 05/12/17 09:52 AM, Jon Mason wrote: >> >> On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin >> wrote: >>> >>> Simple (1 << pidx) operation causes undefined behaviour when >>> pidx >= 32. It must be casted to u64 to match the actual

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Logan Gunthorpe
On 05/12/17 09:52 AM, Jon Mason wrote: On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: Simple (1 << pidx) operation causes undefined behaviour when pidx >= 32. It must be casted to u64 to match the actual return value of ntb_link_is_up() method, so to have all the

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Logan Gunthorpe
On 05/12/17 09:52 AM, Jon Mason wrote: On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: Simple (1 << pidx) operation causes undefined behaviour when pidx >= 32. It must be casted to u64 to match the actual return value of ntb_link_is_up() method, so to have all the possible peer indexes

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Jon Mason
On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: > Simple (1 << pidx) operation causes undefined behaviour when > pidx >= 32. It must be casted to u64 to match the actual return > value of ntb_link_is_up() method, so to have all the possible > peer indexes covered and

Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-05 Thread Jon Mason
On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: > Simple (1 << pidx) operation causes undefined behaviour when > pidx >= 32. It must be casted to u64 to match the actual return > value of ntb_link_is_up() method, so to have all the possible > peer indexes covered and to get rid of undefined

[PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-03 Thread Serge Semin
Simple (1 << pidx) operation causes undefined behaviour when pidx >= 32. It must be casted to u64 to match the actual return value of ntb_link_is_up() method, so to have all the possible peer indexes covered and to get rid of undefined behaviour. Additionally there are special macros in

[PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align()

2017-12-03 Thread Serge Semin
Simple (1 << pidx) operation causes undefined behaviour when pidx >= 32. It must be casted to u64 to match the actual return value of ntb_link_is_up() method, so to have all the possible peer indexes covered and to get rid of undefined behaviour. Additionally there are special macros in