Smatch distrusts simple_strtol().  I don't know the code well enough
to say if the distrust is justified here, but it seems harmless to
silence the warning.

Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>

diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
index 6193270e7b3d..e0508acaedaa 100644
--- a/drivers/misc/kgdbts.c
+++ b/drivers/misc/kgdbts.c
@@ -400,13 +400,15 @@ static void skip_back_repeat_test(char *arg)
        int go_back = simple_strtol(arg, NULL, 10);
 
        repeat_test--;
-       if (repeat_test <= 0) {
+       if (repeat_test <= 0 || go_back < 0) {
                ts.idx++;
        } else {
                if (repeat_test % 100 == 0)
                        v1printk("kgdbts:RUN ... %d remaining\n", repeat_test);
 
                ts.idx -= go_back;
+               if (ts.idx < 0)
+                       ts.idx = 0;
        }
        fill_get_buf(ts.tst[ts.idx].get);
 }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to