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: <69dca1be673a40729d750c00d927b437@EXMBX168.cuchost.com>
Date:   Thu, 22 Dec 2022 09:35:08 +0000
From:   JiaJie Ho <jiajie.ho@...rfivetech.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
        Olivia Mackall <olivia@...enic.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>
CC:     Emil Renner Berthing <kernel@...il.dk>,
        Conor Dooley <conor.dooley@...rochip.com>,
        "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>
Subject: RE: [PATCH 2/3] hwrng: starfive - Add TRNG driver for StarFive SoC



> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> Sent: Wednesday, December 21, 2022 5:49 PM
> To: JiaJie Ho <jiajie.ho@...rfivetech.com>; Olivia Mackall
> <olivia@...enic.com>; Herbert Xu <herbert@...dor.apana.org.au>; Rob
> Herring <robh+dt@...nel.org>; Krzysztof Kozlowski
> <krzysztof.kozlowski+dt@...aro.org>
> Cc: Emil Renner Berthing <kernel@...il.dk>; Conor Dooley
> <conor.dooley@...rochip.com>; linux-crypto@...r.kernel.org;
> devicetree@...r.kernel.org; linux-kernel@...r.kernel.org; linux-
> riscv@...ts.infradead.org
> Subject: Re: [PATCH 2/3] hwrng: starfive - Add TRNG driver for StarFive SoC
> 
> On 21/12/2022 10:08, Jia Jie Ho wrote:
> > This adds driver support for the hardware random number generator in
> > Starfive SoCs and adds StarFive TRNG entry to MAINTAINERS.
> >
> > Co-developed-by: Jenny Zhang <jenny.zhang@...rfivetech.com>
> > Signed-off-by: Jenny Zhang <jenny.zhang@...rfivetech.com>
> > Signed-off-by: Jia Jie Ho <jiajie.ho@...rfivetech.com>
> > ---
> >  MAINTAINERS                            |   6 +
> >  drivers/char/hw_random/Kconfig         |  11 +
> >  drivers/char/hw_random/Makefile        |   1 +
> >  drivers/char/hw_random/starfive-trng.c | 403
> > +++++++++++++++++++++++++
> >  4 files changed, 421 insertions(+)
> >  create mode 100644 drivers/char/hw_random/starfive-trng.c
> >
> 
> (...)
> 
> > +static const struct of_device_id trng_dt_ids[] = {
> > +	{ .compatible = "starfive,jh7110-trng" },
> > +	{ }
> > +};
> > +MODULE_DEVICE_TABLE(of, trng_dt_ids);
> > +
> > +static struct platform_driver starfive_trng_driver = {
> > +	.probe	= starfive_trng_probe,
> > +	.driver	= {
> > +		.name		= "starfive-trng",
> > +		.pm		= &starfive_trng_pm_ops,
> > +		.of_match_table	= of_match_ptr(trng_dt_ids),
> 
> of_match_ptr goes with __maybe_unused. You will have now warnings, so
> please test more your patches (W=1, sparse, smatch).
> 

Hi Krzysztof,

Thanks for reviewing this patch.
How do I properly handle __maybe_unused functions in this scenario?
Will it help if I add #define as follows:

#ifdef CONFIG_PM
#define STARFIVE_RNG_PM_OPS (&starfive_rng_pm_ops)
#else
#define STARFIVE_RNG_PM_OPS NULL
#endif

static struct platform_driver starfive_trng_driver = {
        .probe  = starfive_trng_probe,
        .driver = {
                .name           = "starfive-trng",
                .pm             = STARFIVE_RNG_PM_OPS,
                .of_match_table = of_match_ptr(trng_dt_ids),
        },
};

I did build the patches with the tools mentioned but did not get warnings.
Do I need a specific version, or have I done something wrong?

make C=2 drivers/char/hw_random/
  CHECK   scripts/mod/empty.c
  CALL    scripts/checksyscalls.sh
  CHECK   arch/riscv/kernel/vdso/vgettimeofday.c
  CHECK   drivers/char/hw_random/core.c
  CHECK   drivers/char/hw_random/starfive-trng.c

Regards,
Jia Jie

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ