From 4e29c95d6f61daa838888840cef0cceedc0fcfdd Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 4 Feb 2013 09:14:39 -0800 Subject: [PATCH] mon: enforce reweight be between 0..1 Signed-off-by: Sage Weil Reviewed-by: Joao Luis --- src/mon/OSDMonitor.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 3d11cfffc0fc..507eed74c421 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2527,6 +2527,11 @@ bool OSDMonitor::prepare_command(MMonCommand *m) err = -EINVAL; } else { float w = strtof(m->cmd[3].c_str(), 0); + if (w > 1.0 || w < 0) { + ss << "weight must be in the range [0..1]"; + err = -EINVAL; + goto out; + } long ww = (int)((float)CEPH_OSD_IN*w); if (ww < 0L) { ss << "weight must be > 0"; -- 2.47.3