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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 30 Jan 2024 08:02:51 +0100
From: Stanislaw Gruszka <stanislaw.gruszka@...ux.intel.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Linux PM <linux-pm@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Ulf Hansson <ulf.hansson@...aro.org>
Subject: Re: [PATCH v2 03/10] PM: sleep: stats: Use unsigned int for success
 and failure counters

On Mon, Jan 29, 2024 at 05:13:14PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> Change the type of the "success" and "fail" fields in struct
> suspend_stats to unsigned int, because they cannot be negative.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@...ux.intel.com>

> ---
> 
> v1 -> v2: New patch.
> 
> ---
>  include/linux/suspend.h |    4 ++--
>  kernel/power/main.c     |    6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> Index: linux-pm/include/linux/suspend.h
> ===================================================================
> --- linux-pm.orig/include/linux/suspend.h
> +++ linux-pm/include/linux/suspend.h
> @@ -56,8 +56,8 @@ enum suspend_stat_step {
>  
>  struct suspend_stats {
>  	unsigned int step_failures[SUSPEND_NR_STEPS];
> -	int	success;
> -	int	fail;
> +	unsigned int success;
> +	unsigned int fail;
>  #define	REC_FAILED_NUM	2
>  	int	last_failed_dev;
>  	char	failed_devs[REC_FAILED_NUM][40];
> Index: linux-pm/kernel/power/main.c
> ===================================================================
> --- linux-pm.orig/kernel/power/main.c
> +++ linux-pm/kernel/power/main.c
> @@ -339,8 +339,8 @@ static ssize_t _name##_show(struct kobje
>  }								\
>  static struct kobj_attribute _name = __ATTR_RO(_name)
>  
> -suspend_attr(success, "%d\n");
> -suspend_attr(fail, "%d\n");
> +suspend_attr(success, "%u\n");
> +suspend_attr(fail, "%u\n");
>  suspend_attr(last_hw_sleep, "%llu\n");
>  suspend_attr(total_hw_sleep, "%llu\n");
>  suspend_attr(max_hw_sleep, "%llu\n");
> @@ -458,7 +458,7 @@ static int suspend_stats_show(struct seq
>  	last_step = suspend_stats.last_failed_step + REC_FAILED_NUM - 1;
>  	last_step %= REC_FAILED_NUM;
>  
> -	seq_printf(s, "success: %d\nfail: %d\n",
> +	seq_printf(s, "success: %u\nfail: %u\n",
>  		   suspend_stats.success, suspend_stats.fail);
>  
>  	for (step = SUSPEND_FREEZE; step <= SUSPEND_NR_STEPS; step++)
> 
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ