Re: [patch 2/2] kernel/power/disk.c string fix and if-less iterator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 20 June 2005 23:57:13 +0200, [email protected] wrote:
> 
> Index: quilt/kernel/power/disk.c
> ===================================================================
> --- quilt.orig/kernel/power/disk.c
> +++ quilt/kernel/power/disk.c
> @@ -91,15 +91,13 @@ static void free_some_memory(void)
>  	unsigned int i = 0;
>  	unsigned int tmp;
>  	unsigned long pages = 0;
> -	char *p = "-\\|/";
> +	char p[] = "-\\|/";
>  
>  	printk("Freeing memory...  ");
>  	while ((tmp = shrink_all_memory(10000))) {
>  		pages += tmp;
>  		printk("\b%c", p[i]);
> -		i++;
> -		if (i > 3)
> -			i = 0;
> +		i = (i + 1) % (sizeof(p) - 1);
>  	}
>  	printk("\bdone (%li pages freed)\n", pages);
>  }

Isn't "-\\|/" NUL-terminated and hence 5 characters long?  In that
case, you patch may do funny things.

Jörn

-- 
I've never met a human being who would want to read 17,000 pages of
documentation, and if there was, I'd kill him to get him out of the
gene pool.
-- Joseph Costello
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux