From nobody Sun Feb 8 08:47:47 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 496A926AD0; Wed, 27 Nov 2024 14:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732717871; cv=none; b=oaMkyYX9Uh4QlvXU7qo/GIeH7vVEXXFJGUY1BJ/7Dyk1rxw+YvdSVqGPC8mkRU1lyNtt0iLLPGl44vAfqBYlN+XChGVlijK5UaZfwaCOo4/Q2NIZ4//Zkff4WjWRR9Bu1zgN7vU8ZiKrfoBzEi3P7dmuzossVXA+321YJqJTxVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732717871; c=relaxed/simple; bh=SbWvi8b3kQtxd0QIMyleExujGM9/6bgLGFH9pA41o+U=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=dd0GmmSp98OitCMu41vor2QIsxJfwWgg6m3n8bzf3FxERNSJhLGcv5lsrRWiXlZt1VTygkhVF9R15X5RNy9FGo+zcRPwlD5TbA0m/vqCStXf+mtRgZuJe5l7WRffgPzuPZEb0c0TJVzVaExNBDRrQjSAjLTPvAw3XkSkp//Bao8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FtwH6dmI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=O7CQAmPL; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FtwH6dmI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="O7CQAmPL" Date: Wed, 27 Nov 2024 14:31:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1732717867; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W860JXMaS5h6j69idQvjzaaXJ1b9J9Sr1Z08VvEaE34=; b=FtwH6dmI8cJppsphir/G/FF3qdH+PLcj2d8+wUvaeAzkqxF7RaJ08Ok5ODfFhjVD6/FmwY JJeiW/QupH4NwHTHTPAcv5hSbVNfd5fsMyEh0bXHiaAiGbNkwm5gYUd5RcC2tzPSjK/Bw4 m+DJ8ckWGrpS6sS2fR3hHCbaTwKaE4dKUkgoaEyx7SkRQm3CSGgr+Sa7/YUcTe6tcUCKJ6 b2xRisHax1n+yWgnxw31OyJSF8Qq5THitPKN3bsEryHTn+/4BAPhxoeGC+I/oD5S1RzYDp v35CGwSro9r0SciEE7enssLtRUnqAAuZ0FsREN3WW58h9YGvPcqyih8NKujY8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1732717867; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W860JXMaS5h6j69idQvjzaaXJ1b9J9Sr1Z08VvEaE34=; b=O7CQAmPLPLP+fK/6dSDTlHBs3K7yHJ46ftlWTk9ePg4I9ERi6ZRXVkga3wRuc4dY3JLdCK KTbu89C2PhlkA+DA== From: "tip-bot2 for Marcelo Dalmas" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/urgent] ntp: Remove invalid cast in time offset math Cc: Marcelo Dalmas , Thomas Gleixner , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3CSJ0P101MB03687BF7D5A10FD3C49C51E5F42E2=40SJ0P101MB?= =?utf-8?q?0368=2ENAMP101=2EPROD=2EOUTLOOK=2ECOM=3E?= References: =?utf-8?q?=3CSJ0P101MB03687BF7D5A10FD3C49C51E5F42E2=40SJ0P101M?= =?utf-8?q?B0368=2ENAMP101=2EPROD=2EOUTLOOK=2ECOM=3E?= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <173271786637.412.11744400812569588652.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/urgent branch of tip: Commit-ID: 299130166e70124956c865a66a3669a61db1c212 Gitweb: https://git.kernel.org/tip/299130166e70124956c865a66a3669a61= db1c212 Author: Marcelo Dalmas AuthorDate: Mon, 25 Nov 2024 12:16:09=20 Committer: Thomas Gleixner CommitterDate: Wed, 27 Nov 2024 15:18:45 +01:00 ntp: Remove invalid cast in time offset math Due to an unsigned cast, adjtimex() returns the wrong offest when using ADJ_MICRO and the offset is negative. In this case a small negative offset returns approximately 4.29 seconds (~ 2^32/1000 milliseconds) due to the unsigned cast of the negative offset. Remove the cast and restore the signed division to cure that issue. Fixes: ead25417f82e ("timex: use __kernel_timex internally") Signed-off-by: Marcelo Dalmas Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/SJ0P101MB03687BF7D5A10FD3C49C51E5F42E2@SJ= 0P101MB0368.NAMP101.PROD.OUTLOOK.COM --- kernel/time/ntp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index b550ebe..02e7fe6 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -798,7 +798,7 @@ int __do_adjtimex(struct __kernel_timex *txc, const str= uct timespec64 *ts, =20 txc->offset =3D shift_right(ntpdata->time_offset * NTP_INTERVAL_FREQ, NT= P_SCALE_SHIFT); if (!(ntpdata->time_status & STA_NANO)) - txc->offset =3D (u32)txc->offset / NSEC_PER_USEC; + txc->offset /=3D NSEC_PER_USEC; } =20 result =3D ntpdata->time_state;