All of lore.kernel.org
 help / color / mirror / Atom feed
* [for-4.9 PATCH] xen: credit: change an ASSERT on nr_runnable so that it makes sense.
@ 2017-04-13  7:49 Dario Faggioli
  2017-04-13  9:42 ` Julien Grall
  2017-04-13 14:09 ` George Dunlap
  0 siblings, 2 replies; 6+ messages in thread
From: Dario Faggioli @ 2017-04-13  7:49 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Julien Grall, George Dunlap

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 <andrew.cooper3@citrix.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Julien Grall <julien.grall@arm.com>
---
Julien,

This is very low risk, and I'd call it a bugfix in the sense that it quiesces
coverity.

Dario
---
 xen/common/sched_credit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 93658dc..efdf6bf 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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2017-04-13 14:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-13  7:49 [for-4.9 PATCH] xen: credit: change an ASSERT on nr_runnable so that it makes sense Dario Faggioli
2017-04-13  9:42 ` Julien Grall
2017-04-13  9:45   ` Wei Liu
2017-04-13 10:00   ` Dario Faggioli
2017-04-13 10:17     ` Andrew Cooper
2017-04-13 14:09 ` George Dunlap

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.