Coverity: darray_vprintf(): API usage errors

From: coverity-bot
Date: Tue Feb 13 2024 - 19:04:45 EST


Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20240213 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

Mon Feb 12 13:55:16 2024 -0500
ead021e0fe5b ("thread_with_file: Lift from bcachefs")

Coverity reported the following:

*** CID 1583634: API usage errors (VARARGS)
lib/thread_with_file.c:123 in darray_vprintf()
117 va_copy(args2, args);
118
119 len = vsnprintf(out->data + out->nr, darray_room(*out), fmt, args2);
120 } while (len + 1 > darray_room(*out) && !darray_make_room_gfp(out, len + 1, gfp));
121
122 out->nr += min(len, darray_room(*out));
vvv CID 1583634: API usage errors (VARARGS)
vvv "va_end" was not called for "args2".
123 }
124
125 void stdio_redirect_vprintf(struct stdio_redirect *stdio, bool nonblocking,
126 const char *fmt, va_list args)
127 {
128 struct stdio_buf *buf = &stdio->output;

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot@xxxxxxxxxxxx>
Addresses-Coverity-ID: 1583634 ("API usage errors")
Fixes: ead021e0fe5b ("thread_with_file: Lift from bcachefs")

Thanks for your attention!

--
Coverity-bot