lkml.org 
[lkml]   [2018]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] misc: kgdbts: silence array underflow warning
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.carpenter@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);
}
\
 
 \ /
  Last update: 2018-05-17 14:23    [W:0.042 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site