lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  6 Mar 2020 10:41:44 -0500
From:   Qian Cai <cai@....pw>
To:     peterz@...radead.org, mingo@...hat.com
Cc:     juri.lelli@...hat.com, vincent.guittot@...aro.org,
        dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
        mgorman@...e.de, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com, Qian Cai <cai@....pw>
Subject: [PATCH] sched/cputime: silence a -Wunused-function warning

account_other_time() is only used when CONFIG_IRQ_TIME_ACCOUNTING=y (in
irqtime_account_process_tick()) or CONFIG_VIRT_CPU_ACCOUNTING_GEN=y (in
get_vtime_delta()). When both are off, it will generate a compilation
warning from Clang,

kernel/sched/cputime.c:255:19: warning: unused function
'account_other_time' [-Wunused-function]
static inline u64 account_other_time(u64 max)

Rather than wrapping around this function with a macro expression,

 if defined(CONFIG_IRQ_TIME_ACCOUNTING) || \
    defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN)

just use __maybe_unused for this small function which seems like a good
trade-off.

Signed-off-by: Qian Cai <cai@....pw>
---
 kernel/sched/cputime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index cff3e656566d..85da4d6dee24 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -252,7 +252,7 @@ static __always_inline u64 steal_account_process_time(u64 maxtime)
 /*
  * Account how much elapsed time was spent in steal, irq, or softirq time.
  */
-static inline u64 account_other_time(u64 max)
+static inline __maybe_unused u64 account_other_time(u64 max)
 {
 	u64 accounted;
 
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ