Linus Torvalds writes: (Summary)
HOWEVER, even then it's wrong, because if "size" is of a signed type,
the check in WARN_ONCE is pure garbage.
the check in WARN_ONCE is pure garbage.
To make matters worse, that warning means that
array_index_mask_nospec_check() currently uses it's arguments twice. Macros that look like functions should not use arguments twice.
like functions should not use arguments twice.
So (a) is just wrong right now. 0, "array_index_mask only works for sizes that fit in a positive long");
that fit in a positive long");
but honestly, it's just not worth the code generation pain.
the check in WARN_ONCE is pure garbage.
To make matters worse, that warning means that
array_index_mask_nospec_check() currently uses it's arguments twice. Macros that look like functions should not use arguments twice.
like functions should not use arguments twice.
So (a) is just wrong right now. 0, "array_index_mask only works for sizes that fit in a positive long");
that fit in a positive long");
but honestly, it's just not worth the code generation pain.