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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gRWtVH9NUnY4k4tnR_qLhKfhGMYFkae5b-89z2TrO2xA@mail.gmail.com>
Date:   Thu, 6 Apr 2023 20:32:15 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Dan Williams <dan.j.williams@...el.com>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Linux ACPI <linux-acpi@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Bob Moore <robert.moore@...el.com>,
        Kees Cook <kees@...flux.net>
Subject: Re: [PATCH 22/32] ACPICA: actbl2: Replace 1-element arrays with
 flexible arrays

On Thu, Apr 6, 2023 at 2:36 AM Dan Williams <dan.j.williams@...el.com> wrote:
>
> Rafael J. Wysocki wrote:
> > From: Kees Cook <kees@...flux.net>
> >
> > ACPICA commit 44f1af0664599e87bebc3a1260692baa27b2f264
> >
> > Similar to "Replace one-element array with flexible-array", replace the
> > 1-element array with a proper flexible array member as defined by C99.
> >
> > This allows the code to operate without tripping compile-time and run-
> > time bounds checkers (e.g. via __builtin_object_size(), -fsanitize=bounds,
> > and/or -fstrict-flex-arrays=3).
> >
> > The sizeof() uses with struct acpi_nfit_flush_address and struct
> > acpi_nfit_smbios have been adjusted to drop the open-coded subtraction
> > of the trailing single element. The result is no binary differences in
> > .text nor .data sections.
> >
> > Link: https://github.com/acpica/acpica/commit/44f1af06
> > Signed-off-by: Bob Moore <robert.moore@...el.com>
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> This one needs the following folded in to pass my tests.
>
> Feel free to fold and add:

Done, thank you!

> Co-developed-by: Dan Williams <dan.j.williams@...el.com>
> Signed-off-by: Dan Williams <dan.j.williams@...el.com>
>
> -- >8 --
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 981f8b0f595d..85d9d67e38a4 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -894,7 +894,7 @@ static size_t sizeof_flush(struct acpi_nfit_flush_address *flush)
>  {
>         if (flush->header.length < sizeof(*flush))
>                 return 0;
> -       return sizeof(*flush) + sizeof(u64) * (flush->hint_count - 1);
> +       return struct_size(flush, hint_address, flush->hint_count);
>  }
>
>  static bool add_flush(struct acpi_nfit_desc *acpi_desc,
> diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
> index c75abb497a1a..745c4a27bc35 100644
> --- a/tools/testing/nvdimm/test/nfit.c
> +++ b/tools/testing/nvdimm/test/nfit.c
> @@ -1878,14 +1878,14 @@ static size_t sizeof_spa(struct acpi_nfit_system_address *spa)
>  static int nfit_test0_alloc(struct nfit_test *t)
>  {
>         struct acpi_nfit_system_address *spa = NULL;
> +       struct acpi_nfit_flush_address *flush;
>         size_t nfit_size = sizeof_spa(spa) * NUM_SPA
>                         + sizeof(struct acpi_nfit_memory_map) * NUM_MEM
>                         + sizeof(struct acpi_nfit_control_region) * NUM_DCR
>                         + offsetof(struct acpi_nfit_control_region,
>                                         window_size) * NUM_DCR
>                         + sizeof(struct acpi_nfit_data_region) * NUM_BDW
> -                       + (sizeof(struct acpi_nfit_flush_address)
> -                                       + sizeof(u64) * NUM_HINTS) * NUM_DCR
> +                       + struct_size(flush, hint_address, NUM_HINTS) * NUM_DCR
>                         + sizeof(struct acpi_nfit_capabilities);
>         int i;
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ