Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/bootconfig: use size_t for strlen result in xbc_node_match_prefix()

lib/bootconfig.c:198:19: warning: conversion from 'size_t' to 'int'
may change value [-Wconversion]
lib/bootconfig.c:200:33: warning: conversion to '__kernel_size_t'
from 'int' may change the sign of the result [-Wsign-conversion]

strlen() returns size_t but the result was stored in an int. The value
is then passed back to strncmp() which expects size_t, causing a second
sign-conversion warning on the round-trip. Use size_t throughout to
match the API types.

Link: https://lore.kernel.org/all/20260318155919.78168-11-objecting@objecting.org/

Signed-off-by: Josh Law <objecting@objecting.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

authored by

Josh Law and committed by
Masami Hiramatsu (Google)
68f479de 8f3e7939

+1 -1
+1 -1
lib/bootconfig.c
··· 195 195 xbc_node_match_prefix(struct xbc_node *node, const char **prefix) 196 196 { 197 197 const char *p = xbc_node_get_data(node); 198 - int len = strlen(p); 198 + size_t len = strlen(p); 199 199 200 200 if (strncmp(*prefix, p, len)) 201 201 return false;