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]
Date:	Sun, 02 Jun 2013 19:06:10 -0700
From:	Joe Perches <joe@...ches.com>
To:	Ryan Mallon <rmallon@...il.com>
Cc:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@...el.com>,
	Grant Likely <grant.likely@...retlab.ca>,
	Len Brown <lenb@...nel.org>, linux-kernel@...r.kernel.org,
	David Cohen <david.a.cohen@...el.com>,
	Grant Likely <grant.likely@...aro.org>
Subject: Re: [PATCH v1.1] gpiolib: append SFI helpers for GPIO API

On Mon, 2013-06-03 at 11:59 +1000, Ryan Mallon wrote:
> On 31/05/13 19:27, Andy Shevchenko wrote:
> Some trivial coding style comment below.
[]
> > +	for (i = 0; i < sfi_gpio_num_entry; i++, pentry++) {
> > +		if (!strncmp(name, pentry->pin_name, SFI_NAME_LEN))
> > +			return pentry->pin_no;
> > +	}
> 
> Nitpick - Don't need the braces on the for loop.

I'm not Andy but I think it's preferable to keep the braces
when there's an if in the for loop.

> > +	sfi_gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL);
> 
> Use kcalloc when you have a size and a count.

kmalloc_array unless you want zero'ed memory

> > +	for (i = 0; i < num; i++, pentry++)
> > +		pr_debug("[%2d] chip = %16.16s, name = %16.16s, pin=%d\n", i,
> > +			 pentry->controller_name, pentry->pin_name,
> > +			 pentry->pin_no);
> 
> Why "%16.16s" here? "%16s" will right justify with leading spaces, or
> "%-16s" will left justify with trailing spaces.

This limits the emitted length to 16 regardless of
strlen(pentry->controller_name) / strlen(pentry->pin_name)


--
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