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: <BYAPR11MB32560CEAC6CC3C2E93FBBF9387A89@BYAPR11MB3256.namprd11.prod.outlook.com>
Date:   Tue, 28 Sep 2021 20:39:55 +0000
From:   "Moore, Robert" <robert.moore@...el.com>
To:     "Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
        Arnd Bergmann <arnd@...nel.org>
CC:     Arnd Bergmann <arnd@...db.de>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
        "devel@...ica.org" <devel@...ica.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "llvm@...ts.linux.dev" <llvm@...ts.linux.dev>,
        Len Brown <lenb@...nel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: RE: [PATCH] ACPI: avoid NULL pointer arithmetic

I can take this patch as-is, I think. I'll try for the next acpica release later this week.


-----Original Message-----
From: Wysocki, Rafael J <rafael.j.wysocki@...el.com> 
Sent: Tuesday, September 28, 2021 10:44 AM
To: Arnd Bergmann <arnd@...nel.org>; Moore, Robert <robert.moore@...el.com>
Cc: Arnd Bergmann <arnd@...db.de>; Nathan Chancellor <nathan@...nel.org>; Nick Desaulniers <ndesaulniers@...gle.com>; Erik Kaneda <erik.kaneda@...el.com>; linux-acpi@...r.kernel.org; devel@...ica.org; linux-kernel@...r.kernel.org; llvm@...ts.linux.dev; Len Brown <lenb@...nel.org>; Rafael J. Wysocki <rafael@...nel.org>
Subject: Re: [PATCH] ACPI: avoid NULL pointer arithmetic

Bob, this is ACPICA material.

Would it be possible to apply this to the upstream from the patch or do you need  a PR for this?

On 9/27/2021 2:13 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> There are some very old macros for doing an open-coded offsetof() and 
> cast between pointer and integer in ACPI headers. clang-14 now 
> complains about these:
>
> drivers/acpi/acpica/tbfadt.c:86:3: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
>           ACPI_FADT_OFFSET(pm_timer_block),
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/acpi/actbl.h:376:47: note: expanded from macro 'ACPI_FADT_OFFSET'
>   #define ACPI_FADT_OFFSET(f)             (u16) ACPI_OFFSET (struct acpi_table_fadt, f)
>                                                
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/acpi/actypes.h:511:41: note: expanded from macro 'ACPI_OFFSET'
>   #define ACPI_OFFSET(d, f)               ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) 0)
>                                          
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/acpi/actypes.h:505:79: note: expanded from macro 'ACPI_PTR_DIFF'
>   #define ACPI_PTR_DIFF(a, b)             ((acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b))))
>                                                                                
> ^ ~~~~~~~~~~~~~~~~~~~~~~~ Convert them to the modern equivalents.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>   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 
> 92c71dfce0d5..285bc7b73de3 100644
> --- a/include/acpi/actypes.h
> +++ b/include/acpi/actypes.h
> @@ -507,8 +507,8 @@ typedef u64 acpi_integer;
>   /* Pointer/Integer type conversions */
>   
>   #define ACPI_TO_POINTER(i)              ACPI_CAST_PTR (void, (acpi_size) (i))
> -#define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) 0)
> -#define ACPI_OFFSET(d, f)               ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) 0)
> +#define ACPI_TO_INTEGER(p)              ((uintptr_t)(p))
> +#define ACPI_OFFSET(d, f)               offsetof(d, f)
>   #define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
>   #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
>   


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ