]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hwrng: core - Simplify RNG switching from sysfs
authorLee Jones <lee.jones@linaro.org>
Thu, 17 Sep 2015 13:45:53 +0000 (14:45 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 21 Sep 2015 14:00:41 +0000 (22:00 +0800)
If we attempt to use sysfs to change the current RNG in the usual
way i.e. issuing something like:

`echo 8a8a000.rng > /sys/devices/virtual/misc/hw_random/rng_current`

... it will fail because the code doesn't currently take the '\n'
into consideration.  Well, now it does.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/core.c

index 5643b65cee204d950d842529e0a12123f57e92c0..6f497aa1b27654112bc048f6c207288394015386 100644 (file)
@@ -323,7 +323,7 @@ static ssize_t hwrng_attr_current_store(struct device *dev,
                return -ERESTARTSYS;
        err = -ENODEV;
        list_for_each_entry(rng, &rng_list, list) {
-               if (strcmp(rng->name, buf) == 0) {
+               if (sysfs_streq(rng->name, buf)) {
                        err = 0;
                        if (rng != current_rng)
                                err = set_current_rng(rng);