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:   Mon, 6 Jun 2022 08:55:14 -0700
From:   Guenter Roeck <groeck@...gle.com>
To:     Tzung-Bi Shih <tzungbi@...nel.org>
Cc:     Benson Leung <bleung@...omium.org>,
        Guenter Roeck <groeck@...omium.org>,
        chrome-platform@...ts.linux.dev,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 06/13] platform/chrome: cros_ec_proto: use cros_ec_map_error()

On Mon, Jun 6, 2022 at 7:12 AM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
>
> Use cros_ec_map_error() in cros_ec_get_host_event_wake_mask().
>
> The behavior of cros_ec_get_host_event_wake_mask() slightly changed.  It
> is acceptable because the caller only needs it returns negative integers
> for indicating errors.  Especially, the EC_RES_INVALID_COMMAND still
> maps to -EOPNOTSUPP.
>
> Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>

Reviewed-by: Guenter Roeck <groeck@...omium.org>

> ---
>  drivers/platform/chrome/cros_ec_proto.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index 1b851dcd20c9..71ba6a56ad7c 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -247,7 +247,7 @@ static int cros_ec_get_host_event_wake_mask(struct cros_ec_device *ec_dev,
>                                             uint32_t *mask)
>  {
>         struct ec_response_host_event_mask *r;
> -       int ret;
> +       int ret, mapped;
>
>         msg->command = EC_CMD_HOST_EVENT_GET_WAKE_MASK;
>         msg->version = 0;
> @@ -256,10 +256,9 @@ static int cros_ec_get_host_event_wake_mask(struct cros_ec_device *ec_dev,
>
>         ret = send_command(ec_dev, msg);
>         if (ret >= 0) {
> -               if (msg->result == EC_RES_INVALID_COMMAND)
> -                       return -EOPNOTSUPP;
> -               if (msg->result != EC_RES_SUCCESS)
> -                       return -EPROTO;
> +               mapped = cros_ec_map_error(msg->result);
> +               if (mapped)
> +                       return mapped;
>         }
>         if (ret > 0) {
>                 r = (struct ec_response_host_event_mask *)msg->data;
> --
> 2.36.1.255.ge46751e96f-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ