diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 9278a50d514f..a1b0e213c638 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -836,6 +836,7 @@ void cpumask_shift_left(struct cpumask *dstp, const struct cpumask *srcp, int n) static __always_inline void cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp) { + BUG_ON(large_cpumask_bits > NR_CPUS); bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), large_cpumask_bits); } although I am sure that is not going to be acceptable but it might give a hint about what could be done to deal with this. Another option would be taking advantage of the __diag infrastructure to silence this warning around the bitmap_copy() in cpumask_copy(), stating that we know this can never overflow because of <reason>. I think that would be much more palpable than disabling the warning globally for the kernel, much like Greg said. [1]: https://inbox.sourceware.org/gcc-patches/20241105163132.1922052-1-qing.zhao@xxxxxxxxxx/ Cheers, Nathan