Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp845300lqb; Fri, 24 May 2024 15:54:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVCF7Ulkae8UWa8EBWAMAgwWqDiay4SN0CDL6lecpANwYup139cEcLz1CkptNPcCV8fmUQTmoCyG55zBx7L1XZTa2gx9j0Q2JJG8F0jpQ== X-Google-Smtp-Source: AGHT+IHJI+eRb/X3RrXiOF0fduF+G2Dvniam0zRrrH80XcR3W7viExzF5d8pMzCZ8Q/38V9ZaZB8 X-Received: by 2002:a05:6870:5490:b0:24c:5e82:1b51 with SMTP id 586e51a60fabf-24ca12001b6mr3426313fac.13.1716591269421; Fri, 24 May 2024 15:54:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716591269; cv=pass; d=google.com; s=arc-20160816; b=vh6ALoa83bBQ886KUZf61faHt6A4xNSR1PW8/ml0WAX7ddzDr9j7RO8LPvFL9eqp2Z xR0+v2u3+HhHOBeEMMx0MJTSAYkzInfxLzH2zmhUV89ixYqESWY3z2BYj56ctWtKkEJ5 sceRpsgZkJdIXwHT7nBHNdLXmE3EoDaId8gHPmXcYgBgDOKG4KrsQ8grOp3i/qNoJ6iR YYb9cj3E2C9MbirvUbU3jJssekEVTTb1ufza619P833/0mjZdvBhdFoJeTXm8n5NQ81Q tXpSBXulXR3lImJpaLqc3IAJPMT3Rss656s+YJUABUTPIHKRWy2XP2X6vjrXeLmEuCRm v5rQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=SCMwl4CJ1P6TxmuppacIYNhDQ7TDCETZfazQEPDvVXA=; fh=cvrtT/F4ozXhQktBlm2AvUhpZWYN19pLoN73uhbXuzE=; b=y7WYLxQHjeEOJlXJdEoWKxKac66QEkDlC0K0M8gq7M1w22dESueKD1tPgEq/EyjGH9 Lom5C8MLBA3ozmF0ZWmNuTzgQxC38GZXxmREXPTuln7dWd+X+meJpBbjwIvlEYhonVMf /Z3Udn3AvLb8s3zjk5gOoTdv650ioQQXcFIxZJOze9ft0I8Mz/h6QY4IO48y730+Fk+j 4UqibAOwJQWKSEmktCeuGNzHU0YDhoeuP0hQKvF2tuYhXrkUnJ14NGPFdEBu8FriTlf7 D6Hsu8HF3se6hTGqXPoAXj/H0274zsGOo7xatFSxBYrjVsnTmo6oW5HBl5a18rXnOA34 SKCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dwsL7amQ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-189177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18a885bsi32841851cf.268.2024.05.24.15.54.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 15:54:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dwsL7amQ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-189177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 11B0F1C21067 for ; Fri, 24 May 2024 22:54:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8963128385; Fri, 24 May 2024 22:54:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dwsL7amQ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ByDHtJZ+" 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 C20214A01; Fri, 24 May 2024 22:54:23 +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=1716591265; cv=none; b=CpJAxOYznaFmoqrk25wy9dyaQnuC1bv2q9lpBX/VsKZYyguydYQG/V7rn98IHlkD7XkrRVaQNROxLtFzeVb5swtDiGs0o5NEXaLp0jvBXl0LSk4F1/Ij+wIs5qRwJKihYpMrX8ZTRl2hIY5/BbhUNvtXF+h0aJ0Tqis6WyybsNY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716591265; c=relaxed/simple; bh=h/EU+nzRR8CEV7/SrL/+1rdRmmab8gKxvqbj51zPtmk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=RFKUerFcpTcA+M3vieKFI4SaoJChcq6mlvXOSIiyWGmAIBmRlviTSqo2Kr8xcHjIppO1vJk/6VisumlhGfQyR0IbMrBUfs75SpfL+RlVEXgGfokBKh4wAp3se6uo91EvWo7AEmYXhNFp0mXUt7BPH5XsRL0Sug4+xb9KXApVGi4= 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=dwsL7amQ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ByDHtJZ+; 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 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1716591261; h=from:from: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=SCMwl4CJ1P6TxmuppacIYNhDQ7TDCETZfazQEPDvVXA=; b=dwsL7amQZUciw1KVwOKvuBJLutl7EsVGYknVXwN+2r1vv2SG7GW/0TughWKQLuR/0A39KM BoXOtkXAWKha37SS1YSmGFPg5Ix49P2e5fX6066+a8lJKSPHCBmhOynVRA3D+1qdJTCmiq GzTm0ohZQ6mFD0kJ8XIU8Tq9cnwvIUUfFmq/c6UOvxVzjUU8zGSUGnr1hui1S0qF6s6jDZ MjxzpbTPpUaL54ZL+1/3/uJxCmO0hOHYV8A3Ht5nVOcmfRLe+9riNK4bCC8Qqk9Vt02gL9 9zKSS4QUovIRkoNUtDudGp5YF/4z7TI6x19X89RjAUsP90oaAT25ZeinHtlFxg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716591261; h=from:from: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=SCMwl4CJ1P6TxmuppacIYNhDQ7TDCETZfazQEPDvVXA=; b=ByDHtJZ+kSkCCFuX3D8HZBo6eBdAno5yPFJl/Y7giV/e2hZNMp0jJgkRfNwlCrZtsOj8C+ W3dYwM1v7abxsJCQ== To: Justin Stitt Cc: John Stultz , Stephen Boyd , Nathan Chancellor , Bill Wendling , Nick Desaulniers , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org, Miroslav Lichvar Subject: Re: [PATCH v2] ntp: remove accidental integer wrap-around In-Reply-To: References: <20240517-b4-sio-ntp-usec-v2-1-d539180f2b79@google.com> <87ed9re7i4.ffs@tglx> Date: Sat, 25 May 2024 00:54:21 +0200 Message-ID: <87le3yddnm.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Justin! On Fri, May 24 2024 at 15:43, Justin Stitt wrote: > I appreciate you reviewing my patches. You're welcome! > On Fri, May 24, 2024 at 5:09=E2=80=AFAM Thomas Gleixner wrote: >> So instead of turning the clock back, we might be better off to actually >> put the normalization in place at the assignment: >> >> time_maxerror =3D min(max(0, txc->maxerror), NTP_PHASE_LIMIT); > > A saturating resolution strategy is one that I've taken with some of > my other overflow patches. > > ... but how about: clamp(txc->maxerror, 0, NTP_PHASE_LIMIT) Duh. You are right, but that's too obvious :) Thanks, tglx