Commit 854701ba authored by Yury Norov's avatar Yury Norov

net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}

The functions require to be passed with a cpu index prior to one that is
the first to start search, so the valid input range is [-1, nr_cpu_ids-1).
However, the code checks against [-1, nr_cpu_ids).
Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
parent 944c417d
...@@ -3643,9 +3643,8 @@ static inline bool netif_attr_test_online(unsigned long j, ...@@ -3643,9 +3643,8 @@ static inline bool netif_attr_test_online(unsigned long j,
static inline unsigned int netif_attrmask_next(int n, const unsigned long *srcp, static inline unsigned int netif_attrmask_next(int n, const unsigned long *srcp,
unsigned int nr_bits) unsigned int nr_bits)
{ {
/* -1 is a legal arg here. */ /* n is a prior cpu */
if (n != -1) cpu_max_bits_warn(n + 1, nr_bits);
cpu_max_bits_warn(n, nr_bits);
if (srcp) if (srcp)
return find_next_bit(srcp, nr_bits, n + 1); return find_next_bit(srcp, nr_bits, n + 1);
...@@ -3666,9 +3665,8 @@ static inline int netif_attrmask_next_and(int n, const unsigned long *src1p, ...@@ -3666,9 +3665,8 @@ static inline int netif_attrmask_next_and(int n, const unsigned long *src1p,
const unsigned long *src2p, const unsigned long *src2p,
unsigned int nr_bits) unsigned int nr_bits)
{ {
/* -1 is a legal arg here. */ /* n is a prior cpu */
if (n != -1) cpu_max_bits_warn(n + 1, nr_bits);
cpu_max_bits_warn(n, nr_bits);
if (src1p && src2p) if (src1p && src2p)
return find_next_and_bit(src1p, src2p, nr_bits, n + 1); return find_next_and_bit(src1p, src2p, nr_bits, n + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment