Re: [REGRESSION] RLIMIT_DATA crashes named

From: Joe Perches
Date: Sat Sep 17 2016 - 17:52:48 EST


On Sun, 2016-09-18 at 00:40 +0300, Konstantin Khlebnikov wrote:
> #define printk_periodic(period, fmt, ...)
> ({
>   static unsigned long __prev __read_mostly = INITIAL_JIFFIES - (period);
>   unsigned long __now = jiffies;
>   bool __print = !time_in_range_open(__now, __prev, __prev + (period));
>
>   if (__print) {
>   __prev = __now;
>   printk(fmt, ##__VA_ARGS__);
>   }
>   unlikely(__print);
> })

printk_periodic reads like a thing that would create a
thread to printk a message every period.

And trivially, period should be copied to a temporary
and not be reused (use your choice of # of underscores)

unsigned long _period = period;
unsigned long _now = now;
static unsigned long _prev __read_mostly = etc...