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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 20 Jun 2023 03:09:13 +0000
From:   "Yuan, Perry" <Perry.Yuan@....com>
To:     "Karny, Wyes" <Wyes.Karny@....com>,
        "trenn@...e.com" <trenn@...e.com>,
        "shuah@...nel.org" <shuah@...nel.org>
CC:     "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "rafael@...nel.org" <rafael@...nel.org>,
        "Shenoy, Gautham Ranjal" <gautham.shenoy@....com>,
        "Limonciello, Mario" <Mario.Limonciello@....com>,
        "Huang, Ray" <Ray.Huang@....com>,
        "Limonciello, Mario" <Mario.Limonciello@....com>,
        "Yuan, Perry" <Perry.Yuan@....com>
Subject: RE: [PATCH v3 2/5] cpupower: Add is_valid_path API

[AMD Official Use Only - General]

> -----Original Message-----
> From: Karny, Wyes <Wyes.Karny@....com>
> Sent: Tuesday, June 20, 2023 3:05 AM
> To: trenn@...e.com; shuah@...nel.org
> Cc: linux-pm@...r.kernel.org; linux-kernel@...r.kernel.org; rafael@...nel.org;
> Shenoy, Gautham Ranjal <gautham.shenoy@....com>; Limonciello, Mario
> <Mario.Limonciello@....com>; Huang, Ray <Ray.Huang@....com>; Yuan,
> Perry <Perry.Yuan@....com>; Karny, Wyes <Wyes.Karny@....com>;
> Limonciello, Mario <Mario.Limonciello@....com>
> Subject: [PATCH v3 2/5] cpupower: Add is_valid_path API
>
> Add is_valid_path API to check whether the sysfs file is present or not.
>
> Suggested-by: Gautham R. Shenoy <gautham.shenoy@....com>
> Reviewed-by: Mario Limonciello <mario.limonciello@....com>
> Signed-off-by: Wyes Karny <wyes.karny@....com>
> ---
>  tools/power/cpupower/lib/cpupower.c        | 7 +++++++
>  tools/power/cpupower/lib/cpupower_intern.h | 1 +
>  2 files changed, 8 insertions(+)
>
> diff --git a/tools/power/cpupower/lib/cpupower.c
> b/tools/power/cpupower/lib/cpupower.c
> index 3f7d0c0c5067..7a2ef691b20e 100644
> --- a/tools/power/cpupower/lib/cpupower.c
> +++ b/tools/power/cpupower/lib/cpupower.c
> @@ -14,6 +14,13 @@
>  #include "cpupower.h"
>  #include "cpupower_intern.h"
>
> +int is_valid_path(const char *path)
> +{
> +     if (access(path, F_OK) == -1)
> +             return 0;
> +     return 1;
> +}
> +
>  unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen)  {
>       ssize_t numread;
> diff --git a/tools/power/cpupower/lib/cpupower_intern.h
> b/tools/power/cpupower/lib/cpupower_intern.h
> index ac1112b956ec..5fdb8620d41b 100644
> --- a/tools/power/cpupower/lib/cpupower_intern.h
> +++ b/tools/power/cpupower/lib/cpupower_intern.h
> @@ -7,5 +7,6 @@
>
>  #define SYSFS_PATH_MAX 255
>
> +int is_valid_path(const char *path);
>  unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen);
> unsigned int cpupower_write_sysfs(const char *path, char *buf, size_t buflen);
> --
> 2.34.1

Tested-by: Perry Yuan <Perry.Yuan@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ