memchr_inv() returns non-NULL when a byte differs from the given value. Return true in that case, not when the scanned words are all zero. Signed-off-by: Chenguang Zhao --- net/ethtool/bitset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ethtool/bitset.c b/net/ethtool/bitset.c index 8bb98d3ea3db..56b0c4867ed2 100644 --- a/net/ethtool/bitset.c +++ b/net/ethtool/bitset.c @@ -105,7 +105,7 @@ static bool ethnl_bitmap32_not_zero(const u32 *map, unsigned int start, start_word++; } - if (!memchr_inv(map + start_word, '\0', + if (memchr_inv(map + start_word, '\0', (end_word - start_word) * sizeof(u32))) return true; if (end % 32 == 0) -- 2.25.1