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:   Fri, 15 Oct 2021 20:36:31 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Eugene Shalygin <eugene.shalygin@...il.com>
Cc:     Denis Pauk <pauk.denis@...il.com>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        thomas@...ssschuh.net, Tor Vic <torvic9@...lbox.org>,
        Oleksandr Natalenko <oleksandr@...alenko.name>,
        kernel test robot <lkp@...el.com>,
        Jean Delvare <jdelvare@...e.com>,
        Guenter Roeck <linux@...ck-us.net>,
        Jonathan Corbet <corbet@....net>, linux-hwmon@...r.kernel.org,
        Linux Documentation List <linux-doc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 1/2] hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI.

On Fri, Oct 15, 2021 at 5:26 PM Eugene Shalygin
<eugene.shalygin@...il.com> wrote:

...

> > > +#define        ASUSWMI_METHODID_BREC   0x42524543
> >
> > ...above has definitely an ASCII combination in hex format, care to
> > decode it in the comment?
>
> This is a constant from the WMI dispatch function, the number is a
> four-letter ASCII-encoded method name, here BREC, which is already
> noted in the define identifier. Is it needed to repeat that?

Method name and signature might be different, I tend to ask to add a
comment, simple /* BREC */ at the end of line would suffice.

...

> > > +       utf16s_to_utf8s((wchar_t *)data, len * 2,  UTF16_LITTLE_ENDIAN, buffer, len * 2);
> >
> > > +       for (i = 0; i < len; i++, pos += 2)
> > > +               out[i] = (hex_to_bin(pos[0]) << 4) + hex_to_bin(pos[1]);
> >
> > NIH hex2bin().
>
> Does it make sense to call hex2bin() with size = 1?

Definitely. We don't want homegrown copies of library APIs.

...

> > > +       for (i = 0; i < len; i++) {
> > > +               byte = registers[i] >> 8;
> > > +               *pos = hex_asc_hi(byte);
> > > +               pos++;
> > > +               *pos = hex_asc_lo(byte);
> > > +               pos++;
> > > +               byte = registers[i];
> > > +               *pos = hex_asc_hi(byte);
> > > +               pos++;
> > > +               *pos = hex_asc_lo(byte);
> > > +               pos++;
> > > +       }
> >
> > NIH bin2hex()
>
> bin2hex() can't output UTF-16LE characters, can it? It would need an
> intermediate buffer and a call to convert ASCII (UTF-8) to UTF-16.

I didn't get it. If there is a strong endianess expected the parameter
should be __le16 or __be16, moreover it seems it missed the const
qualifier. Any preparatory stuff should be done in the
asus_wmi_ec_make_block_read_query() which prepares the input buffer,
doesn't it?

So, replace homegwon library APIs.

...

> > > +       obj = output.pointer;
> > > +       if (!obj || obj->type != ACPI_TYPE_BUFFER) {
> >
> > > +               acpi_os_free(obj);
> >
> > What's the point of calling acpi_os_free(obj) when you already know it's NULL?
>
> The case when obj->type != ACPI_TYPE_BUFFER

Read my comment again, please.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ