Re: [Patch net 0/3] idr: fix overflow cases on 32-bit CPU

2019-07-01 Thread Cong Wang
On Mon, Jul 1, 2019 at 7:37 PM Matthew Wilcox wrote: > > On Mon, Jul 01, 2019 at 07:16:00PM -0700, David Miller wrote: > > From: Cong Wang > > Date: Fri, 28 Jun 2019 11:03:40 -0700 > > > > > idr_get_next_ul() is problematic by design, it can't handle > > > the following overflow case well on 32-b

Re: [Patch net 0/3] idr: fix overflow cases on 32-bit CPU

2019-07-01 Thread David Miller
From: Matthew Wilcox Date: Mon, 1 Jul 2019 19:37:30 -0700 > On Mon, Jul 01, 2019 at 07:16:00PM -0700, David Miller wrote: >> From: Cong Wang >> Date: Fri, 28 Jun 2019 11:03:40 -0700 >> >> > idr_get_next_ul() is problematic by design, it can't handle >> > the following overflow case well on 32-b

Re: [Patch net 0/3] idr: fix overflow cases on 32-bit CPU

2019-07-01 Thread Matthew Wilcox
On Mon, Jul 01, 2019 at 07:16:00PM -0700, David Miller wrote: > From: Cong Wang > Date: Fri, 28 Jun 2019 11:03:40 -0700 > > > idr_get_next_ul() is problematic by design, it can't handle > > the following overflow case well on 32-bit CPU: > > > > u32 id = UINT_MAX; > > idr_alloc_u32(&id); > > whi

Re: [Patch net 0/3] idr: fix overflow cases on 32-bit CPU

2019-07-01 Thread David Miller
From: Cong Wang Date: Fri, 28 Jun 2019 11:03:40 -0700 > idr_get_next_ul() is problematic by design, it can't handle > the following overflow case well on 32-bit CPU: > > u32 id = UINT_MAX; > idr_alloc_u32(&id); > while (idr_get_next_ul(&id) != NULL) > id++; > > when 'id' overflows and becomes

[Patch net 0/3] idr: fix overflow cases on 32-bit CPU

2019-06-28 Thread Cong Wang
idr_get_next_ul() is problematic by design, it can't handle the following overflow case well on 32-bit CPU: u32 id = UINT_MAX; idr_alloc_u32(&id); while (idr_get_next_ul(&id) != NULL) id++; when 'id' overflows and becomes 0 after UINT_MAX, the loop goes infinite. Fix this by eliminating externa