linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter-+2lRwdCCLRT2eFz/2MeuCQ@public.gmane.org>
To: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org,
	linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	mpm-VDJrAJ4Gl5ZBDgjK7y7TUQ@public.gmane.org,
	kernel-F5mvAk5X5gdBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH 2/6] hwrng: core: Simplify RNG switching from sysfs
Date: Sun, 13 Sep 2015 16:24:13 +0200	[thread overview]
Message-ID: <87a8sq4ctu.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <1442002110-28733-3-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> (Lee Jones's message of "Fri, 11 Sep 2015 21:08:26 +0100")

>>>>> "Lee" == Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> writes:

 > 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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
 > ---
 >  drivers/char/hw_random/core.c | 7 ++++++-
 >  1 file changed, 6 insertions(+), 1 deletion(-)

 > diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
 > index da8faf7..14dc984 100644
 > --- a/drivers/char/hw_random/core.c
 > +++ b/drivers/char/hw_random/core.c
 > @@ -316,6 +316,7 @@ static ssize_t hwrng_attr_current_store(struct device *dev,
 >  					const char *buf, size_t len)
 >  {
 >  	int err;
 > +	int snip = 0;
 >  	struct hwrng *rng;
 
 >  	err = mutex_lock_interruptible(&rng_mutex);
 > @@ -323,7 +324,11 @@ 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 (buf[len-1] == '\n')
 > +			snip = 1; /* Snip one character */
 > +

How about using sysfs_streq() instead, which is what is done elsewhere?

-- 
Bye, Peter Korsgaard
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-09-13 14:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 20:08 [PATCH 0/6] hwrng: Add support for STMicroelectronics' RNG IP Lee Jones
2015-09-11 20:08 ` [PATCH 1/6] Documentation: hw_random: Fix device node name /dev/hw_random => /dev/hwrng Lee Jones
     [not found]   ` <1442002110-28733-2-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-09-14 14:57     ` Kieran Bingham
2015-09-11 20:08 ` [PATCH 2/6] hwrng: core: Simplify RNG switching from sysfs Lee Jones
     [not found]   ` <1442002110-28733-3-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-09-13 14:24     ` Peter Korsgaard [this message]
2015-09-14  7:27       ` Lee Jones
2015-09-11 20:08 ` [PATCH 3/6] hwrng: st: Provide DT bindings for ST's Random Number Generator Lee Jones
2015-09-11 20:08 ` [PATCH 4/6] hwrng: st: Add support for ST's HW " Lee Jones
2015-09-12 22:58   ` Kieran Bingham
2015-09-14  8:04     ` Lee Jones
2015-09-12 23:04   ` Fabio Estevam
2015-09-14  7:42     ` Lee Jones
2015-09-11 20:08 ` [PATCH 5/6] ARM: STi: STiH407: Enable the 2 HW Random Number Generators for STiH4{07,10} Lee Jones
2015-09-11 20:08 ` [PATCH 6/6] MAINTAINERS: Add ST's Random Number Generator to the ST entry Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8sq4ctu.fsf@dell.be.48ers.dk \
    --to=peter-+2lrwdcclrt2efz/2meucq@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org \
    --cc=kernel-F5mvAk5X5gdBDgjK7y7TUQ@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mpm-VDJrAJ4Gl5ZBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).