Skip to content

Commit 5d9c7a1

Browse files
el-puerrohtejun
authored andcommitted
workqueue: fix -Wformat-truncation in create_worker
Compiling with W=1 emitted the following warning (Compiler: gcc (x86-64, ver. 13.2.1, .config: result of make allyesconfig, "Treat warnings as errors" turned off): kernel/workqueue.c:2188:54: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size between 5 and 14 [-Wformat-truncation=] kernel/workqueue.c:2188:50: note: directive argument in the range [0, 2147483647] kernel/workqueue.c:2188:17: note: ‘snprintf’ output between 4 and 23 bytes into a destination of size 16 setting "id_buf" to size 23 will silence the warning, since GCC determines snprintf's output to be max. 23 bytes in line 2188. Please let me know if there are any mistakes in my patch! Signed-off-by: Lucy Mielke <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent ca10d85 commit 5d9c7a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/workqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,7 @@ static struct worker *create_worker(struct worker_pool *pool)
21662166
{
21672167
struct worker *worker;
21682168
int id;
2169-
char id_buf[16];
2169+
char id_buf[23];
21702170

21712171
/* ID is needed to determine kthread name */
21722172
id = ida_alloc(&pool->worker_ida, GFP_KERNEL);

0 commit comments

Comments
 (0)