Re: gcc-8: mm/swapfile.c:863:40: error: array subscript 1 is above array bounds of 'struct list_head[1]' [-Werror=array-bounds]

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

 



On Mon, 19 Aug 2024 19:44:25 +0800 Kairui Song <ryncsn@xxxxxxxxx> wrote:

> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -836,7 +836,7 @@ static unsigned long cluster_alloc_swap_entry(struct swap_info_struct *si, int o
>  		goto done;
>  
>  	/* Order 0 stealing from higher order */
> -	for (int o = 1; o < PMD_ORDER; o++) {
> +	for (int o = 1; o < SWAP_NR_ORDERS; o++) {
>  		/*
>  		 * Clusters here have at least one usable slots and can't fail order 0
>  		 * allocation, but reclaim may drop si->lock and race with another user.

OK, I got that landed in the right place, but...

The definition of `o' within the for statement isn't typical kernel
style - I'm surprised we didn't get a warning for this - maybe things
have changed when I wasn't looking.

Also, this code makes no attempt to honor our "The preferred limit on
the length of a single line is 80 columns" objective.  There's just no
reason for comment blocks to violate this.

So Chris, please attend to such things when preparing v6, which I
assume is in the works.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux