From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6435396581 for ; Sat, 14 Mar 2026 23:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773531140; cv=pass; b=hInIXVcJZee5Xv4Trv4lcW9SFgur1gWN51559aV9qNS6p3ixZ69YU6CLMIBwCT2/8ImbjRGnnX35O8s/vE1IC573OVNQn2aq27Oq5bTa2UbucJFpVMbb2KsMc+l0W/Sk5eLvu+5lAbB/Ce+Xh+NnX+WFwNhOrM/Pxoatm7T+omY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773531140; c=relaxed/simple; bh=fpDiP5KK6o/eaCzTwQJnTyMGJ0EUlFRoORNRjkvPGzs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ejTBgjmZzmEGLQ2a5j6mBc/GtCS5hPzRcjnOuzV1Jvi5IXURWprYdf9ZTaZ4lxhPBdhogwS27Dgj4NVJeB8JkM5B6dEw+LObh/2HeB04qnEBpwPs7nAP3zMjeKOvAqDiqG0O96VFFkCDMhk8P/oQktPgKtEelMcDuPEwzCjQT7g= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=cnarV8Dx; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="cnarV8Dx" ARC-Seal: i=1; a=rsa-sha256; t=1773531119; cv=none; d=zohomail.eu; s=zohoarc; b=SDC6d9WjgxzfjTByDp+OcpMtSiEKkSum0g0v1uE6lWht5bl8SXaSG9q6dJJqzCRUBy9jC1/FgEpcXpDxnVAqfTVV3ATQKaRAK1ilyqrXecOBSk2jZXyNoPUMALl7rzCoPC4m4fl4r1FUhde7Ak201+ZdeYNkDp51vWg8nxZO+tk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773531119; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=okeqBuqJ5Pkpz8tC88YJ+8yeMMAsnw/SNdzaHg6pf0Q=; b=gTAZE2HmkgAQNOn0IZq15cq1dpGWmBvz5eZyqA/2K5t/mi1QWNZrhQb9F+gk17C00Y99X7T258SFnIqMQh7eCaM++si9kRv6BVRV2pY388+n+M4oSX5tTrOPOVVTdGxSkzZDBInOkZHPcGRWpr8gRZcPIix/IBaoc2SYGo0nsKM= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773531119; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=okeqBuqJ5Pkpz8tC88YJ+8yeMMAsnw/SNdzaHg6pf0Q=; b=cnarV8DxcTA4q3Q4bNu7ThyrItpjFEcjwmGv2Q8hRkyEG2/9STsqXIo7LaLqDO6l 6HW30nRvUVBsThZca8g7/hmvzVLCKyqK3WmUd2vHaPm9R5lWYCcImI3aG6cK94U9zwa vgihLErzIgb86HVGXJPvhqKO9PMHrN6T9KekrDMc= Received: by mx.zoho.eu with SMTPS id 1773531117191642.1015927295734; Sun, 15 Mar 2026 00:31:57 +0100 (CET) From: Josh Law To: Masami Hiramatsu , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v5 23/23] lib/bootconfig: change xbc_node_index() return type to uint16_t Date: Sat, 14 Mar 2026 23:31:44 +0000 Message-Id: <20260314233144.187273-24-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260314233144.187273-1-objecting@objecting.org> References: <20260314233144.187273-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External lib/bootconfig.c:136:21: warning: conversion from 'long int' to 'int' may change value [-Wconversion] lib/bootconfig.c:308:33: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] lib/bootconfig.c:467:37: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] lib/bootconfig.c:469:40: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] lib/bootconfig.c:472:54: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] lib/bootconfig.c:476:45: warning: conversion from 'int' to 'uint16_t' may change value [-Wconversion] xbc_node_index() returns the position of a node in the xbc_nodes array, which has at most XBC_NODE_MAX (8192) entries, well within uint16_t range. Every caller stores the result in a uint16_t field (node->parent, node->child, node->next, or the keys[] array in compose_key_after), so the int return type causes narrowing warnings at all six call sites. Change the return type to uint16_t and add an explicit cast on the pointer subtraction to match the storage width and eliminate the warnings. Signed-off-by: Josh Law --- include/linux/bootconfig.h | 2 +- lib/bootconfig.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/bootconfig.h b/include/linux/bootconfig.h index d78c2b62debf..e5bd46ca7a51 100644 --- a/include/linux/bootconfig.h +++ b/include/linux/bootconfig.h @@ -66,7 +66,7 @@ struct xbc_node { /* Node tree access raw APIs */ struct xbc_node * __init xbc_root_node(void); -int __init xbc_node_index(struct xbc_node *node); +uint16_t __init xbc_node_index(struct xbc_node *node); struct xbc_node * __init xbc_node_get_parent(struct xbc_node *node); struct xbc_node * __init xbc_node_get_child(struct xbc_node *node); struct xbc_node * __init xbc_node_get_next(struct xbc_node *node); diff --git a/lib/bootconfig.c b/lib/bootconfig.c index 68a72dbc38fa..148084abae12 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -131,9 +131,9 @@ struct xbc_node * __init xbc_root_node(void) * * Return the index number of @node in XBC node list. */ -int __init xbc_node_index(struct xbc_node *node) +uint16_t __init xbc_node_index(struct xbc_node *node) { - return node - &xbc_nodes[0]; + return (uint16_t)(node - &xbc_nodes[0]); } /** -- 2.34.1