When advancing buffer by 1, len should be shorthened by appropriate amount, instead of setting it to -1.
Found with cppcheck.
Signed-off-by: Amadeusz Sławiński amade@asmblr.net --- drivers/cuda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cuda.c b/drivers/cuda.c index 86d2ddb..93a935a 100644 --- a/drivers/cuda.c +++ b/drivers/cuda.c @@ -162,7 +162,7 @@ static int cuda_adb_req (void *host, const uint8_t *snd_buf, int len, } } else { pos = buffer + 1; - len = -1; + len -= 1; } memcpy(rcv_buf, pos, len);