Re: [PATCH v3 1/2] alarmtimer: Add PM notifier to check early for imminent alarm

From: Thomas Gleixner
Date: Wed Feb 14 2024 - 06:30:00 EST


On Wed, Feb 14 2024 at 09:29, Pranav Prasad wrote:
> +static int alarmtimer_pm_callback(struct notifier_block *nb,
> + unsigned long mode, void *_unused)
> +{
> + struct rtc_device *rtc;
> + ktime_t min, expires;
> + int type;
> +
> + switch (mode) {
> + case PM_SUSPEND_PREPARE:
> + rtc = alarmtimer_get_rtcdev();
> + /* If we have no rtcdev, just return */
> + if (!rtc)
> + return NOTIFY_DONE;
> +
> + /* Find the soonest timer to expire */
> + if (!alarmtimer_get_soonest(&min, &expires, &type))
> + return NOTIFY_DONE;

Brilliant. Instead of a NULL pointer dereference you decided to add
undefined behaviour this time.

As it survived your "testing" it is obviously correct, right?

I'm tired of your approach to throw stuff at the wall in a hurry and see
what sticks.

Stop this frenzy. Sit down, take your time and do proper engineering
before coming back with this to me.

Thanks,

tglx