On Mon, Jul 18, 2022 at 12:28:29PM -0700, Yury Norov wrote: > bitmap_check_params() takes all arguments passed into bitmap functions > and runs sanity checks. bitmap_check(), bitmap_check_op() and > bitmap_check_move() are convenient wrappers for frequent cases. > > The following patches of this series clear all warnings found with > bitmap_check_params() for x86_64, arm64 and powerpc64. > > The last patch introduces CONFIG_DEBUG_BITMAP option to let user enable > bitmap_check_params(). > > No functional changes for existing kernel users, and for the following > functions inline parameters checks removed: > - bitmap_pos_to_ord; > - bitmap_remap; > - bitmap_onto; > - bitmap_fold. ... > +#define bitmap_check_params(b1, b2, b3, nbits, start, off, flags) \ > + do { \ > + if (__bitmap_check_params((b1), (b2), (b3), (nbits), \ > + (start), (off), (flags))) { \ > + pr_warn("Bitmap: parameters check failed"); \ > + pr_warn("%s [%d]: %s\n", __FILE__, __LINE__, __func__); \ > + } \ > + } while (0) Why printk() and not trace points? Also, try to avoid WARN() / etc in the generic code, it may be easily converted to the BUG() (by kernel command line option, no recompilation needed), and hence make all WARN() effectively reboot machine. Can you guarantee that in all cases the functionality is critical to continue only with correct parameters? -- With Best Regards, Andy Shevchenko