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]
Message-ID: <CABXOdTcaHCPJ18kEJopV6BsoeVvfX66s1v_kpdatgzaqBus7Gw@mail.gmail.com>
Date:   Fri, 5 Apr 2019 12:54:41 -0700
From:   Guenter Roeck <groeck@...gle.com>
To:     Enric Balletbo i Serra <enric.balletbo@...labora.com>
Cc:     linux-kernel <linux-kernel@...r.kernel.org>,
        Gwendal Grignou <gwendal@...omium.org>, jflat@...omium.org,
        kernel@...labora.com, Lee Jones <lee.jones@...aro.org>,
        Benson Leung <bleung@...omium.org>,
        Guenter Roeck <groeck@...omium.org>,
        Rajat Jain <rajatja@...gle.com>,
        Dmitry Torokhov <dtor@...omium.org>
Subject: Re: [PATCH 1/2] platform/chrome: Add CrOS USB PD logging driver

Hi Enric,

On Wed, Apr 3, 2019 at 6:54 AM Enric Balletbo i Serra
<enric.balletbo@...labora.com> wrote:
>
> From: Guenter Roeck <groeck@...omium.org>
>
> The CrOS USB PD logging feature is logically separate functionality of
> the charge manager, hence has its own driver. The driver logs the event
> data for the USB PD charger available in some ChromeOS Embedded
> Controllers.
>
> Signed-off-by: Guenter Roeck <groeck@...omium.org>
> [remove APPEND_STRING macro and minor cleanups]
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@...labora.com>
> ---
>
[ ... ]

> +
> +static void cros_usbpd_print_log_entry(struct ec_response_pd_log *r,
> +                                      ktime_t tstamp)
> +{
[ ... ]
> +
> +       pr_info("PDLOG %d/%02d/%02d %02d:%02d:%02d.%03lld P%d %s\n",
> +               rt.tm_year + 1900, rt.tm_mon + 1, rt.tm_mday,
> +               rt.tm_hour, rt.tm_min, rt.tm_sec,
> +               ktime_to_ms(tstamp) % MSEC_PER_SEC,

0day rightfully complains that this introduces a 64-bit divide
operation. I don't know if do_div() works here since it tries to
modify the first parameter. Maybe we need an interim variable to store
ktime_to_ms(tstamp). Something like

    s64 temp = ktime_to_ms(tstamp);
    ...
                    do_div(temp, MSEC_PER_SEC),

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ