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] [day] [month] [year] [list]
Message-ID: <94F2FBAB4432B54E8AACC7DFDE6C92E3B96643D0@ORSMSX110.amr.corp.intel.com>
Date:   Thu, 1 Aug 2019 20:28:51 +0000
From:   "Moore, Robert" <robert.moore@...el.com>
To:     "Schmauss, Erik" <erik.schmauss@...el.com>, Qian Cai <cai@....pw>,
        "Wysocki, Rafael J" <rafael.j.wysocki@...el.com>
CC:     "jkim@...eBSD.org" <jkim@...eBSD.org>,
        "lenb@...nel.org" <lenb@...nel.org>,
        "ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
        "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
        "devel@...ica.org" <devel@...ica.org>,
        "clang-built-linux@...glegroups.com" 
        <clang-built-linux@...glegroups.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] acpica: fix -Wnull-pointer-arithmetic warnings



-----Original Message-----
From: Schmauss, Erik 
Sent: Thursday, August 01, 2019 1:18 PM
To: Qian Cai <cai@....pw>; Moore, Robert <robert.moore@...el.com>; Wysocki, Rafael J <rafael.j.wysocki@...el.com>
Cc: jkim@...eBSD.org; lenb@...nel.org; ndesaulniers@...gle.com; linux-acpi@...r.kernel.org; devel@...ica.org; clang-built-linux@...glegroups.com; linux-kernel@...r.kernel.org
Subject: RE: [PATCH v2] acpica: fix -Wnull-pointer-arithmetic warnings



> -----Original Message-----
> From: Qian Cai [mailto:cai@....pw]
> Sent: Thursday, August 1, 2019 12:16 PM
> To: Moore, Robert <robert.moore@...el.com>; Wysocki, Rafael J 
> <rafael.j.wysocki@...el.com>
> Cc: Schmauss, Erik <erik.schmauss@...el.com>; jkim@...eBSD.org; 
> lenb@...nel.org; ndesaulniers@...gle.com; linux-acpi@...r.kernel.org; 
> devel@...ica.org; clang-built-linux@...glegroups.com; linux- 
> kernel@...r.kernel.org
> Subject: Re: [PATCH v2] acpica: fix -Wnull-pointer-arithmetic warnings
> 
> On Fri, 2019-07-26 at 19:35 +0000, Moore, Robert wrote:
> > We've taken the change to ACPI_TO_POINTER.
> 
> I am a bit confused here. I saw the commit in the acpia repo.
> 
> https://github.com/acpica/acpica/commit/02bbca5070e42d298c9b824300aa0
> eb8a082d797
> 
> but how does that change will go into the linux kernel? Suppose Rafael 
> will need to pick it up manually?

>I do that after every ACPICA release

Which happens about once per month.

>Erik
> 
> >
> >
> > -----Original Message-----
> > From: Qian Cai [mailto:cai@....pw]
> > Sent: Thursday, July 18, 2019 12:49 PM
> > To: Wysocki, Rafael J <rafael.j.wysocki@...el.com>
> > Cc: Moore, Robert <robert.moore@...el.com>; Schmauss, Erik 
> > <erik.schmauss@...e l.com>; jkim@...eBSD.org; lenb@...nel.org; 
> > ndesaulniers@...gle.com; linux-acpi @vger.kernel.org; 
> > devel@...ica.org; clang-built-linux@...glegroups.com; linux- 
> > kernel@...r.kernel.org; Qian Cai <cai@....pw>
> > Subject: [PATCH v2] acpica: fix -Wnull-pointer-arithmetic warnings
> >
> > Clang generate quite a few of those warnings.
> >
> > drivers/acpi/scan.c:759:28: warning: arithmetic on a null pointer 
> > treated as a cast from integer to pointer is a GNU extension 
> > [-Wnull-pointer-
> arithmetic]
> > 		status = acpi_get_handle(ACPI_ROOT_OBJECT,
> > obj->string.pointer,
> >                                          ^~~~~~~~~~~~~~~~
> > ./include/acpi/actypes.h:458:56: note: expanded from macro
> 'ACPI_ROOT_OBJECT'
> >  #define ACPI_ROOT_OBJECT                ((acpi_handle) 
> > ACPI_TO_POINTER
> > (ACPI_MAX_PTR))
> > 							^~~~~~~~~~~~~~~
> > ./include/acpi/actypes.h:509:41: note: expanded from macro
> 'ACPI_TO_POINTER'
> >  #define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void 
> > *) 0,
> > (acpi_size) (i))
> >
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/acpi/actypes.h:503:84: note: expanded from macro 'ACPI_ADD_PTR'
> >  #define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, 
> > (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b)))
> >                                          ^~~~~~~~~~~~~~~~~
> > ./include/acpi/actypes.h:501:66: note: expanded from macro
> 'ACPI_CAST_PTR'
> >  #define ACPI_CAST_PTR(t, p)             ((t *) (acpi_uintptr_t) 
> > (p))
> >                                                                  ^ 
> > This is because pointer arithmetic on a pointer not pointing to an 
> > array is an undefined behavior (C11 6.5.6, constraint 8). Fix it by 
> > just casting the corresponding pointers using ACPI_CAST_PTR() and 
> > skip the arithmetic. Also, fix a checkpatch warning together.
> >
> > ERROR: Macros with complex values should be enclosed in parentheses
> >  #45: FILE: include/acpi/actypes.h:509:
> > +#define ACPI_TO_POINTER(i)              ACPI_CAST_PTR (void, i)
> >
> > Signed-off-by: Qian Cai <cai@....pw>
> > ---
> >
> > v2: Use ACPI_CAST_PTR() in ACPI_TO_POINTER() directly without
> >     arithmetic.
> >
> >  include/acpi/actypes.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index
> > ad6892a24015..163181e2d884 100644
> > --- a/include/acpi/actypes.h
> > +++ b/include/acpi/actypes.h
> > @@ -506,7 +506,7 @@ typedef u64 acpi_integer;
> >
> >  /* Pointer/Integer type conversions */
> >
> > -#define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void 
> > *) 0,
> > (acpi_size) (i))
> > +#define ACPI_TO_POINTER(i)              (ACPI_CAST_PTR (void, 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_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
> > --
> > 2.20.1 (Apple Git-117)
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ