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  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]
Date:	Fri, 22 Mar 2013 20:44:41 -0600
From:	Stephen Warren <>
To:	Lubomir Rintel <>
CC:, Matt Mackall <>,
Subject: Re: [PATCH] hw_random: Add Broadcom BCM2835 RNG Driver

On 03/22/2013 06:55 AM, Lubomir Rintel wrote:
> Signed-off-by: Lubomir Rintel <>

A commit description would be useful.

>  arch/arm/boot/dts/bcm2835.dtsi       |    5 +
>  arch/arm/configs/bcm2835_defconfig   |    3 +-
>  drivers/char/hw_random/Kconfig       |   12 +++
>  drivers/char/hw_random/Makefile      |    1 +
>  drivers/char/hw_random/bcm2835-rng.c |  137 ++++++++++++++++++++++++++++++++++

This should be split into 3 separate patches: (1) The driver itself, (2)
the change to bcm2835.dtsi, and (3) the change to bcm2835_defconfig.

Since you're adding a new device to device tree for the first time, you
should write a binding document for it; most likely
Documentation/devicetree/bindings/rng/brcm,bcm2835.txt (or perhaps
/random/ rather than /rng/?)

Is this driver based on the downstream Raspberry Pi kernel's driver? If
so, some mention of that fact would be appropriate in the commit
description, or even the git author field. I note that in the downstream
kernel, the commit which adds the RNG driver isn't signed off at all.
This probably means you need to get Dom to add his signed-off-by line
for that commit before basing your work on it. See
Documentation/SubmittingPatches for more details.

> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c

> + * Redistribution and use in source and binary forms, with or without
> + * ALTERNATIVELY, this software may be distributed under the terms of the
> + * GNU General Public License ("GPL") version 2, as published by the Free
> + * Software Foundation.

I am not a lawyer, but I'd be tempted to exercise that right, and
distribute this patch solely under the terms of the GPLv2, and hence
remove the other license. It's not a big deal, but it'd simplify the
licensing in the upstream kernel.

> +static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,
> +			       bool wait)

> +	while ((__raw_readl(rng_base + RNG_STATUS)>>24) == 0) {

You'd usually put spaces around the >>.

> +static int bcm2835_rng_probe(struct platform_device *op)

"pdev" is a more typical name than "op".

> +{
> +	struct device *dev = &op->dev;
> +	struct device_node *np = dev->of_node;
> +	void __iomem *rng_base;
> +	int err;
> +
> +	/* map peripheral */
> +	rng_base = of_iomap(np, 0);
> +	if (WARN(!rng_base, "failed to remap rng regs"))
> +		return -ENODEV;

The WARN() doesn't seem necessary. dev_err() inside the if{} would be
more appropriate,

> +static struct platform_driver bcm2835_rng_driver = {
> +};
> +
> +module_platform_driver(bcm2835_rng_driver);

Typically, no blank line there.

> +MODULE_AUTHOR("Lubomir Rintel <>");
> +MODULE_DESCRIPTION("BCM2835 Random Number Generator (RNG) driver");
> +MODULE_LICENSE("GPL and additional rights");

I think that should be "GPLv2 and ...".
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists