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: <CAPcyv4g7wBJvw-yNz58eGcLYSvsSHOGZsZV8Px=WRacQ5Ur2Og@mail.gmail.com>
Date:   Fri, 29 Apr 2022 11:56:46 -0700
From:   Dan Williams <dan.j.williams@...el.com>
To:     Michal Suchanek <msuchanek@...e.de>
Cc:     Linux NVDIMM <nvdimm@...ts.linux.dev>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Dave Jiang <dave.jiang@...el.com>,
        Ira Weiny <ira.weiny@...el.com>, Zou Wei <zou_wei@...wei.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] testing: nvdimm: iomap: make __nfit_test_ioremap a macro

On Fri, Apr 29, 2022 at 6:41 AM Michal Suchanek <msuchanek@...e.de> wrote:
>
> The ioremap passed as argument to __nfit_test_ioremap can be a macro so
> it cannot be passed as function argument. Make __nfit_test_ioremap into
> a macro so that ioremap can be passed as untyped macro argument.
>

Looks reasonable to me and passes tests, applied.

> Signed-off-by: Michal Suchanek <msuchanek@...e.de>
> ---
>  tools/testing/nvdimm/test/iomap.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c
> index b752ce47ead3..ea956082e6a4 100644
> --- a/tools/testing/nvdimm/test/iomap.c
> +++ b/tools/testing/nvdimm/test/iomap.c
> @@ -62,16 +62,14 @@ struct nfit_test_resource *get_nfit_res(resource_size_t resource)
>  }
>  EXPORT_SYMBOL(get_nfit_res);
>
> -static void __iomem *__nfit_test_ioremap(resource_size_t offset, unsigned long size,
> -               void __iomem *(*fallback_fn)(resource_size_t, unsigned long))
> -{
> -       struct nfit_test_resource *nfit_res = get_nfit_res(offset);
> -
> -       if (nfit_res)
> -               return (void __iomem *) nfit_res->buf + offset
> -                       - nfit_res->res.start;
> -       return fallback_fn(offset, size);
> -}
> +#define __nfit_test_ioremap(offset, size, fallback_fn) ({              \
> +       struct nfit_test_resource *nfit_res = get_nfit_res(offset);     \
> +       nfit_res ?                                                      \
> +               (void __iomem *) nfit_res->buf + (offset)               \
> +                       - nfit_res->res.start                           \
> +       :                                                               \
> +               fallback_fn((offset), (size)) ;                         \
> +})
>
>  void __iomem *__wrap_devm_ioremap(struct device *dev,
>                 resource_size_t offset, unsigned long size)
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ