nospec: Allow index argument to have const-qualified type
[pandora-kernel.git] / include / linux / nospec.h
index 4232e73..6f06589 100644 (file)
@@ -53,7 +53,6 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
        BUILD_BUG_ON(sizeof(_i) > sizeof(long));                        \
        BUILD_BUG_ON(sizeof(_s) > sizeof(long));                        \
                                                                        \
-       _i &= _mask;                                                    \
-       _i;                                                             \
+       (typeof(_i)) (_i & _mask);                                      \
 })
 #endif /* _LINUX_NOSPEC_H */