[flashrom] [PATCH] Remove unnecessary includes

Uwe Hermann uwe at hermann-uwe.de
Sun May 30 13:55:00 CEST 2010


On Sun, May 30, 2010 at 03:06:31AM +0200, Carl-Daniel Hailfinger wrote:
> Compile tests on non-x86 and non-Linux platforms highly appreciated.
> 
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Acked-by: Uwe Hermann <uwe at hermann-uwe.de>

Compile-tested on x86 Linux only, though.
 

> Index: flashrom-include_cleanup/physmap.c
> ===================================================================
> --- flashrom-include_cleanup/physmap.c	(Revision 1017)
> +++ flashrom-include_cleanup/physmap.c	(Arbeitskopie)
[...]
> @@ -311,7 +313,7 @@
>  {
>  	char msrfilename[64];
>  	memset(msrfilename, 0, 64);

Maybe we should also replace this hardcoded 64 with a sizeof()?


> -	sprintf(msrfilename, "/dev/cpu/%d/msr", cpu);
> +	snprintf(msrfilename, sizeof(msrfilename), "/dev/cpu/%d/msr", cpu);
>  
>  	if (fd_msr != -1) {
>  		msg_pinfo("MSR was already initialized\n");
> @@ -394,7 +396,7 @@
>  {
>  	char msrfilename[64];
>  	memset(msrfilename, 0, 64);

Ditto.


> -	sprintf(msrfilename, "/dev/cpu%d", cpu);
> +	snprintf(msrfilename, sizeof(msrfilename), "/dev/cpu%d", cpu);
>  
>  	if (fd_msr != -1) {
>  		msg_pinfo("MSR was already initialized\n");


Uwe.
-- 
http://hermann-uwe.de     | http://sigrok.org
http://randomprojects.org | http://unmaintained-free-software.org




More information about the flashrom mailing list