From: Mike Frysinger Date: Wed, 23 Nov 2011 17:11:01 -0500 Subject: [U-Boot] [PATCH] M28: Added pin name support in GPIO driver In-Reply-To: <3A9F4839-B299-4A7A-9618-423D8E8BDD82@delien.nl> References: <4ECCB7DB.8040607@denx.de> <3A9F4839-B299-4A7A-9618-423D8E8BDD82@delien.nl> Message-ID: <201111231711.02187.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday 23 November 2011 04:51:45 Robert Deli?n wrote: > + if (name[0] >= '0' && name[0] <= '9') { > + pin_nr = simple_strtoul(name, (char **)&name, 10); > + if (name[0]) > + return -EINVAL; > > Why do we need this check ? We have already copied / converted the > number in pin_nr, we do not need to check in the string again. And you > do not need to update name, because you are returning in any case. > > This check checks if name pointer - after it's updated by simple_strtoul - > points to the terminating NULL character. If if does, name contained a > valid number. If it doesn't, it's pointing to trailing garbage and hence > name didn't contain a valid number. In other words; This checks prevents a > string like 3kjh;khji being interpreted as 3. your client apparently lacks proper quoting. please do something about this. it's fairly difficult to figure out what you're saying and what you're quoting. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: