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: <201106202216.20343.PeterHuewe@gmx.de>
Date:	Mon, 20 Jun 2011 22:16:19 +0200
From:	Peter Hüwe <PeterHuewe@....de>
To:	Alexey Dobriyan <adobriyan@...il.com>
Cc:	Samuel Ortiz <sameo@...ux.intel.com>,
	Srinidhi Kasagar <srinidhi.kasagar@...ricsson.com>,
	Linus Walleij <linus.walleij@...ricsson.com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Ian Lartey <ian@...nsource.wolfsonmicro.com>,
	Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/2 v2] mfd/ab3550: Convert to kstrtou8_from_user

Am Montag 20 Juni 2011, 21:50:38 schrieb Alexey Dobriyan:
> On Mon, Jun 20, 2011 at 09:46:28PM +0200, Peter Huewe wrote:
> > -	char buf[32];
> > -	int buf_size;
> > -	unsigned long user_address;
> > +	u8 user_address;

> > +	/* Get userspace string and convert to number */
> > +	err = kstrtou8_from_user(user_buf, count, 0, &user_address);
...
> > 
> >  	ab->debug_address = user_address;

> 
> You don't need temporary variable and should write straight to final
> location, because kstrto* functions will never write to result unless it
> was converted successfully.

Alexey thank you very much for your review, hints and most of all patience ;)
The code really gets cleaner and cleaner.

While changing the code (once again ;) and looking at your remarks I also saw 
that ab3550->debug_address and ->debug_bank are always casted to u8.

Do you think I could also change the two fields of the struct ab3550 (only 
used in this file) to u8 in this patch, too?
This way I could get rid of the u8* cast which is now needed in this case, if 
I take you last remark into account.
> err = kstrtou8_from_user(user_buf, count, 0, (u8 *)&ab->debug_address);

And also clean the code from all the other unnecessary u8 casts.

What do you think?
Or split it up into two seperate patches?

Thanks,
Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ