all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH datacenter-manager] ui: pbs: datastore: don't underflow for estimation calculation
@ 2026-12-01 13:08 Dominik Csapak
  2026-12-01 14:57 ` applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2026-12-01 13:08 UTC (permalink / raw)
  To: pdm-devel

PBS calculates the 'estimated full' timestamp with a linear regression.
This can be in the past, and depending on the actual values, it can
be a very large negative number. In that case it could happen that the
subtraction here underflowed, resulting in a panic in debug mode and
very wrong values in release mode.

Using saturating_sub here prevents both.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/pbs/datastore/overview.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/src/pbs/datastore/overview.rs b/ui/src/pbs/datastore/overview.rs
index 23e68170..c576d918 100644
--- a/ui/src/pbs/datastore/overview.rs
+++ b/ui/src/pbs/datastore/overview.rs
@@ -312,7 +312,7 @@ fn render_estimated_full(store: &PbsDatastoreResource, now: i64) -> String {
     let Some(full_date) = store.estimated_full_date else {
         return tr!("Not enough data");
     };
-    let remaining = full_date - now;
+    let remaining = full_date.saturating_sub(now);
     if remaining <= 0 {
         tr!("Never")
     } else {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* applied: [PATCH datacenter-manager] ui: pbs: datastore: don't underflow for estimation calculation
  2026-12-01 13:08 [PATCH datacenter-manager] ui: pbs: datastore: don't underflow for estimation calculation Dominik Csapak
@ 2026-12-01 14:57 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-12-01 14:57 UTC (permalink / raw)
  To: pdm-devel, Dominik Csapak

On Tue, 01 Dec 2026 14:08:41 +0100, Dominik Csapak wrote:
> PBS calculates the 'estimated full' timestamp with a linear regression.
> This can be in the past, and depending on the actual values, it can
> be a very large negative number. In that case it could happen that the
> subtraction here underflowed, resulting in a panic in debug mode and
> very wrong values in release mode.
> 
> Using saturating_sub here prevents both.
> 
> [...]

Applied, thanks!

[1/1] ui: pbs: datastore: don't underflow for estimation calculation
      commit: e996407d46d7d024a5af466becfc127f7a6a9854




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-01 14:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 13:08 [PATCH datacenter-manager] ui: pbs: datastore: don't underflow for estimation calculation Dominik Csapak
2026-12-01 14:57 ` applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal