From: Sage Weil Date: Mon, 4 Feb 2013 17:14:39 +0000 (-0800) Subject: mon: enforce reweight be between 0..1 X-Git-Tag: v0.57~58 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4e29c95d6f61daa838888840cef0cceedc0fcfdd;p=ceph.git mon: enforce reweight be between 0..1 Signed-off-by: Sage Weil Reviewed-by: Joao Luis --- 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";