From: Dario Faggioli Date: Thu, 13 Apr 2017 07:49:54 +0000 (+0200) Subject: xen: credit: change an ASSERT on nr_runnable so that it makes sense. X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2233 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=341569f1d18df00bda6625a77c2b106cee382562;p=xen.git xen: credit: change an ASSERT on nr_runnable so that it makes sense. Since the counter is unsigned, it's pointless/bogous to check for if to be above zero. Check that it is at least one before it's decremented, instead. Spotted by Coverity. Reported-by: Andrew Cooper Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap Release-acked-by: Julien Grall --- diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 93658dcfe5..efdf6bf2f3 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -275,8 +275,8 @@ static inline void dec_nr_runnable(unsigned int cpu) { ASSERT(spin_is_locked(per_cpu(schedule_data, cpu).schedule_lock)); + ASSERT(CSCHED_PCPU(cpu)->nr_runnable >= 1); CSCHED_PCPU(cpu)->nr_runnable--; - ASSERT(CSCHED_PCPU(cpu)->nr_runnable >= 0); } static inline void