From nobody Sun Feb 8 05:40:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 345AD239581 for ; Thu, 30 Oct 2025 13:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830422; cv=none; b=sFv/u7p3ugfICq6/4/y/RSufnVLx6fexK3vGiIQoEp1ddDonoVvpdiF/KpWL+hQAAdQ6p0U2y55QhtrRK7mugoTNDgMsNGJEP5e4IyNCk2LFSnC29tNxajYNUnouguS86IuSfOHYrW3a5xfLo869Zb2kEXtv8Gokc4izYU1KsNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830422; c=relaxed/simple; bh=t+VAbGP0izDtAZ+6eVeuOVCKXrQofbV//RSDU+DmLNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ek3clEjxEX4ENmyKGM7d044stWVzOXVWiBF3xiWnGdNxLOCc4kvAzgKj/s7WI+r9UJ6DGWesAvjIwiKdQ14mCEez8c/qU464qCBNwG2ypEaZb4e+f8WvtBo0NqTS0D/9lZ5/6HxLHawMYypSBVFxWrwqOUUiZJIH1RTSHIgiiqg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JutMtQYx; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JutMtQYx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761830419; x=1793366419; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=t+VAbGP0izDtAZ+6eVeuOVCKXrQofbV//RSDU+DmLNM=; b=JutMtQYxFclqkUx5Kl94cLUmTGCfJkvxQ50ciGAsulPeLK3706PQzHlI IoK8qXnJoX0n5fG3ON/Vja56/I1FDffUbRckDKiiAd1f2X1nm0wpsgcMy BncrUaSS3tSlJln0PoBiGEZ5/gunlOp3eo5CADkz8+yqtWhXiVFNfPZ7b dMaSxUzYY5R1s/Oh0Fm0YflgUoY95g4FdByM2EmmNWiDXAQbD/zI4GavQ LKzAvRyFDcke42S2gs2L5Jwy5yY3nyq8HsqPo661IGIVi5uO1RWuchZvQ B+tToMkupKcg10pvLyKv1Xgr4CXcT58vE/AR3SBpFloSt0MsAE1yg/Sdr Q==; X-CSE-ConnectionGUID: wdmnD7t3QMWB0bhm1U3gnQ== X-CSE-MsgGUID: IUadHKvJR+mwLA3jVuPgwg== X-IronPort-AV: E=McAfee;i="6800,10657,11598"; a="75318715" X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="75318715" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2025 06:20:18 -0700 X-CSE-ConnectionGUID: F+MatMJpQnmEu6cQUWAFlA== X-CSE-MsgGUID: BG6xEhI4Q2O0ijmKrQnihg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="185213892" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa010.jf.intel.com with ESMTP; 30 Oct 2025 06:20:19 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 6FA5F97; Thu, 30 Oct 2025 14:20:18 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH v3 1/6] panic: sys_info: Capture si_bits_global before iterating over it Date: Thu, 30 Oct 2025 12:44:17 +0100 Message-ID: <20251030132007.3742368-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> References: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The for-loop might re-read the content of the memory the si_bits_global points to on each iteration. Instead, just capture it for the sake of consistency and use that instead. Reviewed-by: Feng Tang Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek --- lib/sys_info.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index 496f9151c9b6..d542a024406a 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -58,11 +58,11 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_= table, int write, char names[sizeof(sys_info_avail)]; struct ctl_table table; unsigned long *si_bits_global; + unsigned long si_bits; =20 si_bits_global =3D ro_table->data; =20 if (write) { - unsigned long si_bits; int ret; =20 table =3D *ro_table; @@ -81,9 +81,12 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_t= able, int write, char *delim =3D ""; int i, len =3D 0; =20 + /* The access to the global value is not synchronized. */ + si_bits =3D READ_ONCE(*si_bits_global); + names[0] =3D '\0'; for (i =3D 0; i < ARRAY_SIZE(si_names); i++) { - if (*si_bits_global & si_names[i].bit) { + if (si_bits & si_names[i].bit) { len +=3D scnprintf(names + len, sizeof(names) - len, "%s%s", delim, si_names[i].name); delim =3D ","; --=20 2.50.1 From nobody Sun Feb 8 05:40:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 D4505238C1A for ; Thu, 30 Oct 2025 13:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830422; cv=none; b=uTzSzov3EWXUc2jjWt3mHHguvBhet+KIMChuRLfbZVCjVwkkkJKi2I+EgL18q8c6sCAQCl6GfG0xMYNk2Yvz/FG2QManKL1/4kXhf1XR+tNYDMGOHBOh7yZF+8bbwHwOahl1RxQG1WjYxYPB9ihAJW6oF9t1C0LPx+lWX69rS1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830422; c=relaxed/simple; bh=A6aFzq7aWb1ouGnLNfuHinjTz+8h8YEe3xtoATyHhlk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tb3Fpw4WnskSjm1Yrw80x7ygvfOa0+eF/Qi06Fb8ElmWHTmWw+iI1vyt20DGjXG0wslQxor81TLeS/G5Q0+5v7/N8U1O0JprmQZIT7vgrAHhIF8tgkmRnLf0f7ey12qv3ahFCVrojzmvbIH5ALrAgYo3ix7bXATWNND46qqoIlQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bnPXwAsf; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bnPXwAsf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761830421; x=1793366421; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A6aFzq7aWb1ouGnLNfuHinjTz+8h8YEe3xtoATyHhlk=; b=bnPXwAsfO/39ZzmhpN9gzigi4Dt1v7SkAS1h1Kl7ZL12F6lTIUsPqH8Q kXeLbGGbuNbR8QXX7lVnEWpONchSRcDpH1Idcv/fhnJe8/6Qz5jA4unAV J2EaN7OXAM4whTRJKuwXmYAuPMdu9TDFy8O/EZqkWdpvHO64HR4JdAK2j xQSoj8FZtKoEUiFHr6p9vAhajbU0yVJhQF4GY4wvtjW9SMiP004yPN3Nx skrcp1USfNro+RXkfyIAVnsNKidjXuuYqOIMrXa7g72DAnsT0W2seosGc LcWr8UFvHRWzFif+PeQ/nHeN5e8xwTbt303zpcgk2XsZla3SQ5g7lZz0a w==; X-CSE-ConnectionGUID: 8jBn/2TKQgWs+hdHscXg6w== X-CSE-MsgGUID: nynXspdGRWC3sw9HobM8FQ== X-IronPort-AV: E=McAfee;i="6800,10657,11531"; a="63875748" X-IronPort-AV: E=Sophos;i="6.17,312,1747724400"; d="scan'208";a="63875748" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2025 06:20:21 -0700 X-CSE-ConnectionGUID: HBW2v6KOTIm5vKEKJA5mBA== X-CSE-MsgGUID: w5yYLgcEQxGIbYxNaInhwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="191093198" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa005.jf.intel.com with ESMTP; 30 Oct 2025 06:20:17 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 73ED798; Thu, 30 Oct 2025 14:20:18 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH v3 2/6] panic: sys_info: Align constant definition names with parameters Date: Thu, 30 Oct 2025 12:44:18 +0100 Message-ID: <20251030132007.3742368-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> References: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Align constant definition names with parameters to make it easier to map. It's also better to maintain and extend the names while keeping their uniqueness. Reviewed-by: Feng Tang Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek --- include/linux/sys_info.h | 2 +- kernel/panic.c | 2 +- lib/sys_info.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/sys_info.h b/include/linux/sys_info.h index 89d77dc4f2ed..a5bc3ea3d44b 100644 --- a/include/linux/sys_info.h +++ b/include/linux/sys_info.h @@ -14,7 +14,7 @@ #define SYS_INFO_LOCKS 0x00000008 #define SYS_INFO_FTRACE 0x00000010 #define SYS_INFO_PANIC_CONSOLE_REPLAY 0x00000020 -#define SYS_INFO_ALL_CPU_BT 0x00000040 +#define SYS_INFO_ALL_BT 0x00000040 #define SYS_INFO_BLOCKED_TASKS 0x00000080 =20 void sys_info(unsigned long si_mask); diff --git a/kernel/panic.c b/kernel/panic.c index 341c66948dcb..0d52210a9e2b 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -401,7 +401,7 @@ static void panic_trigger_all_cpu_backtrace(void) */ static void panic_other_cpus_shutdown(bool crash_kexec) { - if (panic_print & SYS_INFO_ALL_CPU_BT) + if (panic_print & SYS_INFO_ALL_BT) panic_trigger_all_cpu_backtrace(); =20 /* diff --git a/lib/sys_info.c b/lib/sys_info.c index d542a024406a..6b0188b30227 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -23,7 +23,7 @@ static const struct sys_info_name si_names[] =3D { { SYS_INFO_TIMERS, "timers" }, { SYS_INFO_LOCKS, "locks" }, { SYS_INFO_FTRACE, "ftrace" }, - { SYS_INFO_ALL_CPU_BT, "all_bt" }, + { SYS_INFO_ALL_BT, "all_bt" }, { SYS_INFO_BLOCKED_TASKS, "blocked_tasks" }, }; =20 @@ -118,7 +118,7 @@ void sys_info(unsigned long si_mask) if (si_mask & SYS_INFO_FTRACE) ftrace_dump(DUMP_ALL); =20 - if (si_mask & SYS_INFO_ALL_CPU_BT) + if (si_mask & SYS_INFO_ALL_BT) trigger_all_cpu_backtrace(); =20 if (si_mask & SYS_INFO_BLOCKED_TASKS) --=20 2.50.1 From nobody Sun Feb 8 05:40:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 4F11623F26A for ; Thu, 30 Oct 2025 13:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830423; cv=none; b=TCTC56iIaz7PLQ7WW8c5MJjRhdxOSst9uywIhUwOB0KIiCPctIyv6IyHRr+Et6PFs2cd66Lthp7dMsV929VkHsGGLEwHNntgt7t58pykeWiE4aryVeXa95fDMZWB1woYhz5n83ImeKBFGPa9U7zX72GKJWjb4hVBne/RroIt6kU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830423; c=relaxed/simple; bh=2BVQ+Utgl3MIvxAIbys54i5YDo2PSGETCCd/ZKN+Ves=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mgEQZoy9npoveMBLFLyuA1VhJhXj++JvYzzqhZQ2R+1FhE5yzZYSFtJ0UpuZ8TmGJn1mZaP6f2eZG0dcMsQPivgeYKfZpqrimIviX22WJ/JIaLovXZW2SqkWonLyxnuEYo9yg3gzhMr9nCb0un1CGaNhacT4ezqsNTDrqyTHjnk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mR4yFvR1; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mR4yFvR1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761830421; x=1793366421; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2BVQ+Utgl3MIvxAIbys54i5YDo2PSGETCCd/ZKN+Ves=; b=mR4yFvR1IGpYyXyd6llF+sHrCKy6F5UovUd25OOe9VuQvg4VOrrIWHz+ hT0xzHVVTWPesxqkTTJb9C7JzFcZjDD9t9HSoKkwg64lRSG+PdJ9FgDN6 TkOXXM5aH0i8s0gqR0cArMD6Oo7goA8wNEJxLuSHkYlg3iBP+A2IyMn5Y ElCXTwsLEuZcYm5XoglX8Tb7AHtgb1j4i0yE4JTa7KAjxPiSJmSGniAq2 VE4MYZhlHsN8s1nhbGTOtZoHm2+lw50zh791r+D6FfmyhNyx9O2nbycHX Q4v0Zi2OlU/G6ZezkvRtmU9wVHU0P7MwS3CH6WgQ3VCjuY9FO8rWmhrMo A==; X-CSE-ConnectionGUID: 0u6jSVWuRdqhLEz8KrQVDA== X-CSE-MsgGUID: ztgD373QQ+erqRh5MTADow== X-IronPort-AV: E=McAfee;i="6800,10657,11598"; a="89437050" X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="89437050" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2025 06:20:20 -0700 X-CSE-ConnectionGUID: SvBEd8zPTP6E9MLTdnlfCg== X-CSE-MsgGUID: cJHczWWHTAi/S9xSxuu6wA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="190026363" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa003.jf.intel.com with ESMTP; 30 Oct 2025 06:20:19 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 7839499; Thu, 30 Oct 2025 14:20:18 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH v3 3/6] panic: sys_info: Replace struct sys_info_name with plain array of strings Date: Thu, 30 Oct 2025 12:44:19 +0100 Message-ID: <20251030132007.3742368-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> References: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is no need to keep a custom structure just for the need of a plain array of strings. Replace struct sys_info_name with plain array of strings. With that done, simplify the code, in particular, naturally use for_each_set_bit() when iterating over si_bits_global bitmap. Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek --- lib/sys_info.c | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index 6b0188b30227..29a63238b31d 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -1,30 +1,29 @@ // SPDX-License-Identifier: GPL-2.0-only -#include +#include #include +#include #include #include -#include #include +#include +#include +#include =20 #include =20 -struct sys_info_name { - unsigned long bit; - const char *name; -}; - /* * When 'si_names' gets updated, please make sure the 'sys_info_avail' * below is updated accordingly. */ -static const struct sys_info_name si_names[] =3D { - { SYS_INFO_TASKS, "tasks" }, - { SYS_INFO_MEM, "mem" }, - { SYS_INFO_TIMERS, "timers" }, - { SYS_INFO_LOCKS, "locks" }, - { SYS_INFO_FTRACE, "ftrace" }, - { SYS_INFO_ALL_BT, "all_bt" }, - { SYS_INFO_BLOCKED_TASKS, "blocked_tasks" }, +static const char * const si_names[] =3D { + [ilog2(SYS_INFO_TASKS)] =3D "tasks", + [ilog2(SYS_INFO_MEM)] =3D "mem", + [ilog2(SYS_INFO_TIMERS)] =3D "timers", + [ilog2(SYS_INFO_LOCKS)] =3D "locks", + [ilog2(SYS_INFO_FTRACE)] =3D "ftrace", + [ilog2(SYS_INFO_PANIC_CONSOLE_REPLAY)] =3D "", + [ilog2(SYS_INFO_ALL_BT)] =3D "all_bt", + [ilog2(SYS_INFO_BLOCKED_TASKS)] =3D "blocked_tasks", }; =20 /* Expecting string like "xxx_sys_info=3Dtasks,mem,timers,locks,ftrace,...= " */ @@ -36,12 +35,9 @@ unsigned long sys_info_parse_param(char *str) =20 s =3D str; while ((name =3D strsep(&s, ",")) && *name) { - for (i =3D 0; i < ARRAY_SIZE(si_names); i++) { - if (!strcmp(name, si_names[i].name)) { - si_bits |=3D si_names[i].bit; - break; - } - } + i =3D match_string(si_names, ARRAY_SIZE(si_names), name); + if (i >=3D 0) + __set_bit(i, &si_bits); } =20 return si_bits; @@ -85,10 +81,10 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_= table, int write, si_bits =3D READ_ONCE(*si_bits_global); =20 names[0] =3D '\0'; - for (i =3D 0; i < ARRAY_SIZE(si_names); i++) { - if (si_bits & si_names[i].bit) { + for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) { + if (*si_names[i]) { len +=3D scnprintf(names + len, sizeof(names) - len, - "%s%s", delim, si_names[i].name); + "%s%s", delim, si_names[i]); delim =3D ","; } } --=20 2.50.1 From nobody Sun Feb 8 05:40:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 D8E9E239072 for ; Thu, 30 Oct 2025 13:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830423; cv=none; b=BCKVHRrFmd+f9cMobA7AZZFM9CvKD0AYBULANAsKaHj+NNk4rnnOCuf+bkkko6xcxDcOhSL64lM3+Jrj1buGeo5+JVU1iSnqaaZhVrS9OA2xspq1LvveTxJHMcQyqVoOLmtTMqMqtVyFn0Q14+VRq8ZriU9Llb6aUNVoQCVAWHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830423; c=relaxed/simple; bh=pipPwBd5AyvREjP14OzA37kDTkYMiAbD24jynGRexI0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P+CUbTQwv1ArRnBbqZnMb3CohknSHPy5if52J0NocuUen95OX/ZmpndIALQ73NnLgJsXzkqPolQSfgtWcJV6j4uBYyPBK+pCVBSHUwYF+eGDW1ZCZsgzxG7uFTGurO2epsdIRlEXq2c0uCYthMl68Nc4Unop/cIpgbTN4uoOcwE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WFKIns/G; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WFKIns/G" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761830421; x=1793366421; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pipPwBd5AyvREjP14OzA37kDTkYMiAbD24jynGRexI0=; b=WFKIns/GxqPPWWTo50pZl8dvWgoE57bUlS6n/h5mftlApwiuJiDC84IU YrpzQ1XtwNpQAXJ3Z5CkrNBzYzDgAWQrQ93DVgf07s9JfljnAyz9kNuRH J4CNxGwIbpfMwAqaXp6NzdVNAlM/0gkcW8hDZZ88cTPrxsqPKvlo3mBIR vLrnSDwuCx0MV45n1NQ1cJe+rOSlpnr3zreD7bybBE4blsyCMEaTa264d qZ0+Sy8Rj4J9w+SvJDNov18brY+iS7XMvWopcDtgJM7Gtz2+zdkawfse0 Fw4PmEktfaMOMrpb9nUTeBIFgpOoedBTPG2suaTbGnwRux/EUK9HlrGgf w==; X-CSE-ConnectionGUID: Sr++BTtgTvm3ALpstdr7CA== X-CSE-MsgGUID: gbkOVWm2Tdi1NS7QXoIckg== X-IronPort-AV: E=McAfee;i="6800,10657,11598"; a="64067351" X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="64067351" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2025 06:20:20 -0700 X-CSE-ConnectionGUID: t+UIWPqST/Sey8yQpZ7asw== X-CSE-MsgGUID: PPbksveWReucsvYv7ujaOQ== X-ExtLoop1: 1 Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa003.fm.intel.com with ESMTP; 30 Oct 2025 06:20:19 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 7BD7C9A; Thu, 30 Oct 2025 14:20:18 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH v3 4/6] panic: sys_info: Rewrite a fix for a compilation error (`make W=1`) Date: Thu, 30 Oct 2025 12:44:20 +0100 Message-ID: <20251030132007.3742368-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> References: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Compiler was not happy about dead variable in use: lib/sys_info.c:52:19: error: variable 'sys_info_avail' is not needed and wi= ll not be emitted [-Werror,-Wunneeded-internal-declaration] 52 | static const char sys_info_avail[] =3D "tasks,mem,timers,locks,ftra= ce,all_bt,blocked_tasks"; | ^~~~~~~~~~~~~~ This was fixed by adding __maybe_unused attribute that just hides the issue and didn't actually fix the root cause. Rewrite the fix by moving the local variable from stack to a heap. As a side effect this drops unneeded "synchronisation" of duplicative info and also makes code ready for the further refactoring. Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek --- lib/sys_info.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index 29a63238b31d..eb5c1226bfc8 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only +#include #include +#include #include #include #include @@ -11,10 +13,6 @@ =20 #include =20 -/* - * When 'si_names' gets updated, please make sure the 'sys_info_avail' - * below is updated accordingly. - */ static const char * const si_names[] =3D { [ilog2(SYS_INFO_TASKS)] =3D "tasks", [ilog2(SYS_INFO_MEM)] =3D "mem", @@ -45,25 +43,32 @@ unsigned long sys_info_parse_param(char *str) =20 #ifdef CONFIG_SYSCTL =20 -static const char sys_info_avail[] __maybe_unused =3D "tasks,mem,timers,lo= cks,ftrace,all_bt,blocked_tasks"; - int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write, void *buffer, size_t *lenp, loff_t *ppos) { - char names[sizeof(sys_info_avail)]; struct ctl_table table; unsigned long *si_bits_global; unsigned long si_bits; + unsigned int i; + size_t maxlen; =20 si_bits_global =3D ro_table->data; =20 + maxlen =3D 0; + for (i =3D 0; i < ARRAY_SIZE(si_names); i++) + maxlen +=3D strlen(si_names[i]) + 1; + + char *names __free(kfree) =3D kzalloc(maxlen, GFP_KERNEL); + if (!names) + return -ENOMEM; + if (write) { int ret; =20 table =3D *ro_table; table.data =3D names; - table.maxlen =3D sizeof(names); + table.maxlen =3D maxlen; ret =3D proc_dostring(&table, write, buffer, lenp, ppos); if (ret) return ret; @@ -74,16 +79,15 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_= table, int write, return 0; } else { /* for 'read' operation */ + unsigned int len =3D 0; char *delim =3D ""; - int i, len =3D 0; =20 /* The access to the global value is not synchronized. */ si_bits =3D READ_ONCE(*si_bits_global); =20 - names[0] =3D '\0'; for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) { if (*si_names[i]) { - len +=3D scnprintf(names + len, sizeof(names) - len, + len +=3D scnprintf(names + len, maxlen - len, "%s%s", delim, si_names[i]); delim =3D ","; } @@ -91,7 +95,7 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_ta= ble, int write, =20 table =3D *ro_table; table.data =3D names; - table.maxlen =3D sizeof(names); + table.maxlen =3D maxlen; return proc_dostring(&table, write, buffer, lenp, ppos); } } --=20 2.50.1 From nobody Sun Feb 8 05:40:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 EC627285042 for ; Thu, 30 Oct 2025 13:20:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830424; cv=none; b=jbtVK3zxSR1dxGrgQHK63uXmF5OXzwKpXJd2PbKtp9nkiK8bh+EjA2X5tViFyocHb7GTi0Ljd0s70SE7MAsQm9Cpx9BDKMfIKtubPctl2fkvZd6CIQeJcHFw42GYx9NkejZMX2ZzjuYlnTUpAVKGbCHc+pvEadD4+TeUqRg3Xy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830424; c=relaxed/simple; bh=j3Iy5TsM+zh63y8DLtoL/2/mRZGYZJvZUQjdwpw7YJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OBwDqu/1Ey5MIYBO1jlGaVWl/Th0sJ4tZjXqxLqGuSSEznOOANiIxwt03WbqiB+ddoBMtjUXIVAQW5Cuw5UBeWgJATOxKNG/hBIlM0/erTuBk8OEv+YOpUz+adKvDeBmyVyq5+OGEGIZP+dZt13PLp9Ak5genbUBAUs13SLbR1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=k26JlIjh; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="k26JlIjh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761830423; x=1793366423; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j3Iy5TsM+zh63y8DLtoL/2/mRZGYZJvZUQjdwpw7YJQ=; b=k26JlIjhl6reGE/PJpQ+82k4fSNdSRqSA0iuqkjPbfrSBqwwG15Auhgr 6OS2cgWe7o9AFA5CIg47p+2dxVTk5GaxwKGgR2NeGh634Oms83NC1RZlB UploCw4gIC7pVCYLtoFqZcB3EvYq1w8BmeEjI7vJmbWsin6jfYVgjbLAK rxMF9E4s0kJ/c0Kd4zM81a1sktADqOWdpF/BXdUAInwSP4uE7KfUaW9yC ZRSv2nF7Y+VYzi5e3rY4kjt00Z0tq4andiy74WLYXRvLO9v+ePO0biZH6 HYwAcin5B/Zo5VOGyAcNe/8Gv3auEo/4AbwrKqNZxOR7ewblagrbD33GS g==; X-CSE-ConnectionGUID: R61FqDgDTamysdvt0U6dhw== X-CSE-MsgGUID: nmawhlYpQuyxWzdJQud0eA== X-IronPort-AV: E=McAfee;i="6800,10657,11531"; a="63875752" X-IronPort-AV: E=Sophos;i="6.17,312,1747724400"; d="scan'208";a="63875752" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2025 06:20:23 -0700 X-CSE-ConnectionGUID: kSeavGr1TCCuFDP1H5GO6w== X-CSE-MsgGUID: v05Xf2oQSNiZ3ZnKw4F+Vg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="190312797" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa005.fm.intel.com with ESMTP; 30 Oct 2025 06:20:21 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 7FD139B; Thu, 30 Oct 2025 14:20:18 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH v3 5/6] panic: sys_info: Deduplicate local variable 'table; assignments Date: Thu, 30 Oct 2025 12:44:21 +0100 Message-ID: <20251030132007.3742368-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> References: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The both handlers use the local 'table' variable and assign the same data to it, deduplicate that. Reviewed-by: Feng Tang Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek --- lib/sys_info.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index eb5c1226bfc8..94526de8482b 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -63,12 +63,13 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_= table, int write, if (!names) return -ENOMEM; =20 + table =3D *ro_table; + table.data =3D names; + table.maxlen =3D maxlen; + if (write) { int ret; =20 - table =3D *ro_table; - table.data =3D names; - table.maxlen =3D maxlen; ret =3D proc_dostring(&table, write, buffer, lenp, ppos); if (ret) return ret; @@ -93,9 +94,6 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_ta= ble, int write, } } =20 - table =3D *ro_table; - table.data =3D names; - table.maxlen =3D maxlen; return proc_dostring(&table, write, buffer, lenp, ppos); } } --=20 2.50.1 From nobody Sun Feb 8 05:40:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 8D557248898 for ; Thu, 30 Oct 2025 13:20:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830424; cv=none; b=hkIWXkhwhIDmRhTbE9jmi+LPE3cSloVmzbTGt6o/wkJlX6xFFfuhKzrc7YWW/QQVvCbEV18ewJHPEFzjWPKoZA7MG8SiFhf6+fwUrhZ2nF+kS9WuKhJ7RqtPPxnh0K3347n+g4KblF5VZGucN50KtxwVqwzOHo1kklZYJavdHCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761830424; c=relaxed/simple; bh=iWlei57EODHFejhXUBF8taQYMWzeXgAy5ZeOWJpOW/k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jyw4nTz+wBcE7wxPb0qebwuZX34GCFHAFEWrTfMt4PhCx4jsyTt/v/YsJNM/e4KNSXDemDSTQQSTYfBmX5ObisBIdfAEyETGIbnhlvHu5bzSLIdtPtsLX3JweV/++o11JdqwJYZ9zaxPyhT4Q10m0hIqFscBKiB3iCMpdLs3g78= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=n9beZm6+; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="n9beZm6+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761830423; x=1793366423; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iWlei57EODHFejhXUBF8taQYMWzeXgAy5ZeOWJpOW/k=; b=n9beZm6+1RLBsTR5zsqE4IH7MfUmk37YRCIZRJ+ZHerItoX6+5WV2DbC y9wl3EXk8mPJCahT4auiP3N/JLfl7L2R6SrnQs9U47me8H1GMT7xn7Fhh v01o2nF394P3a99ipYrieOtrdpuhKAIEmGh/uvXJd83KMW60GCbSCg/vX HovKOBvgjHcBUImp/tS/eQL/5SnUV08xWjx9G8peBukv+8PwGXv9RI4eR B21MWEnfFGe0Iz93eLvHixzwSxIq/RwD5lwhR7Bg5W84qYZ9DOnmsTC4u 4vkmwjk3zo65XphWcRrMJj8Eo+3njMzm3U8EjpDBtg94PAqFIPUA67pro Q==; X-CSE-ConnectionGUID: pVV6FEt6QimLhBAPJPalqQ== X-CSE-MsgGUID: yupXkVsUSn6cFc/HL0NaTw== X-IronPort-AV: E=McAfee;i="6800,10657,11598"; a="86597428" X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="86597428" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2025 06:20:22 -0700 X-CSE-ConnectionGUID: TSCf+tGuQCuZv1bxsMhFqw== X-CSE-MsgGUID: RPbAXf6UTyGZNjzutw5Mqw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,266,1754982000"; d="scan'208";a="185154316" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa006.jf.intel.com with ESMTP; 30 Oct 2025 06:20:21 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 83A819C; Thu, 30 Oct 2025 14:20:18 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH v3 6/6] panic: sys_info: Factor out read and write handlers Date: Thu, 30 Oct 2025 12:44:22 +0100 Message-ID: <20251030132007.3742368-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> References: <20251030132007.3742368-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For the sake of the code readability and easier maintenance factor out read and write sys_info handlers. Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek --- lib/sys_info.c | 79 +++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index 94526de8482b..874b9471a068 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -43,18 +43,56 @@ unsigned long sys_info_parse_param(char *str) =20 #ifdef CONFIG_SYSCTL =20 +static int sys_info_write_handler(struct ctl_table *table, + void *buffer, size_t *lenp, loff_t *ppos, + unsigned long *si_bits_global) +{ + unsigned long si_bits; + int ret; + + ret =3D proc_dostring(table, 1, buffer, lenp, ppos); + if (ret) + return ret; + + si_bits =3D sys_info_parse_param(table->data); + + /* The access to the global value is not synchronized. */ + WRITE_ONCE(*si_bits_global, si_bits); + + return 0; +} + +static int sys_info_read_handler(struct ctl_table *table, + void *buffer, size_t *lenp, loff_t *ppos, + unsigned long *si_bits_global) +{ + unsigned long si_bits; + unsigned int len =3D 0; + char *delim =3D ""; + unsigned int i; + + /* The access to the global value is not synchronized. */ + si_bits =3D READ_ONCE(*si_bits_global); + + for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) { + if (*si_names[i]) { + len +=3D scnprintf(table->data + len, table->maxlen - len, + "%s%s", delim, si_names[i]); + delim =3D ","; + } + } + + return proc_dostring(table, 0, buffer, lenp, ppos); +} + int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table table; - unsigned long *si_bits_global; - unsigned long si_bits; unsigned int i; size_t maxlen; =20 - si_bits_global =3D ro_table->data; - maxlen =3D 0; for (i =3D 0; i < ARRAY_SIZE(si_names); i++) maxlen +=3D strlen(si_names[i]) + 1; @@ -67,35 +105,10 @@ int sysctl_sys_info_handler(const struct ctl_table *ro= _table, int write, table.data =3D names; table.maxlen =3D maxlen; =20 - if (write) { - int ret; - - ret =3D proc_dostring(&table, write, buffer, lenp, ppos); - if (ret) - return ret; - - si_bits =3D sys_info_parse_param(names); - /* The access to the global value is not synchronized. */ - WRITE_ONCE(*si_bits_global, si_bits); - return 0; - } else { - /* for 'read' operation */ - unsigned int len =3D 0; - char *delim =3D ""; - - /* The access to the global value is not synchronized. */ - si_bits =3D READ_ONCE(*si_bits_global); - - for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) { - if (*si_names[i]) { - len +=3D scnprintf(names + len, maxlen - len, - "%s%s", delim, si_names[i]); - delim =3D ","; - } - } - - return proc_dostring(&table, write, buffer, lenp, ppos); - } + if (write) + return sys_info_write_handler(&table, buffer, lenp, ppos, ro_table->data= ); + else + return sys_info_read_handler(&table, buffer, lenp, ppos, ro_table->data); } #endif =20 --=20 2.50.1