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

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