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: <1563975605.11067.8.camel@lca.pw>
Date:   Wed, 24 Jul 2019 09:40:05 -0400
From:   Qian Cai <cai@....pw>
To:     "Moore, Robert" <robert.moore@...el.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     "Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
        "Schmauss, Erik" <erik.schmauss@...el.com>,
        "jkim@...ebsd.org" <jkim@...ebsd.org>, Len Brown <lenb@...nel.org>,
        "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
        "devel@...ica.org" <devel@...ica.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] acpica: fix -Wnull-pointer-arithmetic warnings

On Tue, 2019-07-23 at 20:49 +0000, Moore, Robert wrote:
> > > Signed-off-by: Qian Cai <cai@....pw>
> > > ---
> > > include/acpi/actypes.h | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 
> > > ad6892a24015..25b4a32da177 100644
> > > --- a/include/acpi/actypes.h
> > > +++ b/include/acpi/actypes.h
> > > @@ -500,13 +500,13 @@ typedef u64 acpi_integer;
> > > 
> > > #define ACPI_CAST_PTR(t, p)             ((t *) (acpi_uintptr_t) (p))
> > > #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (acpi_uintptr_t) (p))
> > > -#define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR
> > > (u8, (a)) + (acpi_size)(b)))
> > > +#define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (a) +
> > > (acpi_size)(b))
> 
> We have some questions concerning this change. If (a) is not cast to a u8, the
> addition will be in whatever units are appropriate for (a) i.e., the type of
> (a). However, we want ACPI_ADD_PTR (And ACPI_SUB_PTR) to simply perform a byte
> addition or subtraction - thus the cast to u8. I believe that is the original
> thinking behind the macros.

I posted a v2 a while ago, and should clear this concern.

> 
> > > #define ACPI_SUB_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR
> > > (u8, (a)) - (acpi_size)(b)))
> > > #define ACPI_PTR_DIFF(a, b)             ((acpi_size) (ACPI_CAST_PTR (u8,
> > > (a)) - ACPI_CAST_PTR (u8, (b))))
> > > 
> > > /* Pointer/Integer type conversions */
> > > 
> > > -#define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) 0,
> > > (acpi_size) (i))
> > > +#define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, 0,
> > > (acpi_size) (i))
> > 
> > IIUC, these are adding `i` to NULL (or (void*)0)? X + 0 == X ?
> > --
> > Thanks,
> > ~Nick Desaulniers
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ