Re: [PATCH] ipc: Update semtimedop() to use hrtimer

From: Thomas Gleixner
Date: Thu Apr 28 2022 - 03:47:13 EST


On Wed, Apr 27 2022 at 23:42, Prakash Sangappa wrote:
>> On Apr 27, 2022, at 3:06 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> Converting to ktime first makes this cheaper:
>>
>> expires = ktime_get() + timespec64_to_ns(timeout);
>
> Since user provided timespec is added to current time, shouldn’t it check for overflow?
>
> So, perhaps
>
> expires = ktime_add_safe(ktime_get(), timespec64_to_ns(timeout));

Of course. This was just for illustration and I assumed you figure it
out, which you did. :)

Thanks,

tglx