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-prev] [day] [month] [year] [list]
Message-ID: <20201008230703.gjpz2ixngyfbqume@earth.universe>
Date:   Fri, 9 Oct 2020 01:07:03 +0200
From:   Sebastian Reichel <sre@...nel.org>
To:     "Harley A.W. Lorenzo" <hl1998@...tonmail.com>
Cc:     Joe Perches <joe@...ches.com>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "wangxiongfeng2@...wei.com" <wangxiongfeng2@...wei.com>
Subject: Re: [PATCH] test_power: add missing newlines when printing
 parameters by sysfs

Hi,

On Mon, Oct 05, 2020 at 04:44:17AM +0000, Harley A.W. Lorenzo wrote:
> On Monday, October 5, 2020 12:19 AM, Joe Perches <joe@...ches.com> wrote:
> > I did not suggest this.
> 
> My apologies. Revised patch (still diffing from Xiongfeng Wang) here.
> 
> [PATCH v2] test_power: revise parameter printing to use sprintf
> 
> Signed-off-by: Harley A.W. Lorenzo <hl1998@...tonmail.com>
> Suggested-by: Joe Perches <joe@...ches.com>
> ---

Thanks, I fixed the commit message and applied this.

-- Sebastian

>  drivers/power/supply/test_power.c | 32 +++++++++++++------------------
>  1 file changed, 13 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/power/supply/test_power.c b/drivers/power/supply/test_power.c
> index 4895ee5e63a9..5f510ddc946d 100644
> --- a/drivers/power/supply/test_power.c
> +++ b/drivers/power/supply/test_power.c
> @@ -352,9 +352,8 @@ static int param_set_ac_online(const char *key, const struct kernel_param *kp)
> 
>  static int param_get_ac_online(char *buffer, const struct kernel_param *kp)
>  {
> -	strcpy(buffer, map_get_key(map_ac_online, ac_online, "unknown"));
> -	strcat(buffer, "\n");
> -	return strlen(buffer);
> +	return sprintf(buffer, "%s\n",
> +			map_get_key(map_ac_online, ac_online, "unknown"));
>  }
> 
>  static int param_set_usb_online(const char *key, const struct kernel_param *kp)
> @@ -366,9 +365,8 @@ static int param_set_usb_online(const char *key, const struct kernel_param *kp)
> 
>  static int param_get_usb_online(char *buffer, const struct kernel_param *kp)
>  {
> -	strcpy(buffer, map_get_key(map_ac_online, usb_online, "unknown"));
> -	strcat(buffer, "\n");
> -	return strlen(buffer);
> +	return sprintf(buffer, "%s\n",
> +			map_get_key(map_ac_online, usb_online, "unknown"));
>  }
> 
>  static int param_set_battery_status(const char *key,
> @@ -381,9 +379,8 @@ static int param_set_battery_status(const char *key,
> 
>  static int param_get_battery_status(char *buffer, const struct kernel_param *kp)
>  {
> -	strcpy(buffer, map_get_key(map_status, battery_status, "unknown"));
> -	strcat(buffer, "\n");
> -	return strlen(buffer);
> +	return sprintf(buffer, "%s\n",
> +			map_get_key(map_ac_online, battery_status, "unknown"));
>  }
> 
>  static int param_set_battery_health(const char *key,
> @@ -396,9 +393,8 @@ static int param_set_battery_health(const char *key,
> 
>  static int param_get_battery_health(char *buffer, const struct kernel_param *kp)
>  {
> -	strcpy(buffer, map_get_key(map_health, battery_health, "unknown"));
> -	strcat(buffer, "\n");
> -	return strlen(buffer);
> +	return sprintf(buffer, "%s\n",
> +			map_get_key(map_ac_online, battery_health, "unknown"));
>  }
> 
>  static int param_set_battery_present(const char *key,
> @@ -412,9 +408,8 @@ static int param_set_battery_present(const char *key,
>  static int param_get_battery_present(char *buffer,
>  					const struct kernel_param *kp)
>  {
> -	strcpy(buffer, map_get_key(map_present, battery_present, "unknown"));
> -	strcat(buffer, "\n");
> -	return strlen(buffer);
> +	return sprintf(buffer, "%s\n",
> +			map_get_key(map_ac_online, battery_present, "unknown"));
>  }
> 
>  static int param_set_battery_technology(const char *key,
> @@ -429,10 +424,9 @@ static int param_set_battery_technology(const char *key,
>  static int param_get_battery_technology(char *buffer,
>  					const struct kernel_param *kp)
>  {
> -	strcpy(buffer,
> -		map_get_key(map_technology, battery_technology, "unknown"));
> -	strcat(buffer, "\n");
> -	return strlen(buffer);
> +	return sprintf(buffer, "%s\n",
> +			map_get_key(map_ac_online, battery_technology,
> +					"unknown"));
>  }
> 
>  static int param_set_battery_capacity(const char *key,
> --
> 2.28.0

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ