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]
Message-Id: <20081202164732.1d6d0997.akpm@linux-foundation.org>
Date:	Tue, 2 Dec 2008 16:47:32 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Hugh Dickins <hugh@...itas.com>
Cc:	dwmw2@...radead.org, jens.axboe@...cle.com, matthew@....cx,
	joern@...fs.org, James.Bottomley@...senPartnership.com,
	djshin90@...il.com, teheo@...e.de, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/9] swapfile: change discard pgoff_t to sector_t

On Mon, 1 Dec 2008 00:29:41 +0000 (GMT)
Hugh Dickins <hugh@...itas.com> wrote:

> Change pgoff_t nr_blocks in discard_swap() and discard_swap_cluster() to
> sector_t: given the constraints on swap offsets (in particular, the 5 bits
> of swap type accommodated in the same unsigned long), pgoff_t was actually
> safe as is, but it certainly looked worrying when shifted left.
> 
> Signed-off-by: Hugh Dickins <hugh@...itas.com>
> ---
> To follow 9/9 swapfile-swap-allocation-cycle-if-nonrot.patch
> 
>  mm/swapfile.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- swapfile9/mm/swapfile.c	2008-11-26 12:19:00.000000000 +0000
> +++ swapfile10/mm/swapfile.c	2008-11-28 20:36:44.000000000 +0000
> @@ -96,7 +96,7 @@ static int discard_swap(struct swap_info
>  
>  	list_for_each_entry(se, &si->extent_list, list) {
>  		sector_t start_block = se->start_block << (PAGE_SHIFT - 9);
> -		pgoff_t nr_blocks = se->nr_pages << (PAGE_SHIFT - 9);
> +		sector_t nr_blocks = se->nr_pages << (PAGE_SHIFT - 9);

but, but, that didn't change anything?  se->nr_pages must be cast to
sector_t?

>  		if (se->start_page == 0) {
>  			/* Do not discard the swap header page! */
> @@ -133,7 +133,7 @@ static void discard_swap_cluster(struct 
>  		    start_page < se->start_page + se->nr_pages) {
>  			pgoff_t offset = start_page - se->start_page;
>  			sector_t start_block = se->start_block + offset;
> -			pgoff_t nr_blocks = se->nr_pages - offset;
> +			sector_t nr_blocks = se->nr_pages - offset;
>  
>  			if (nr_blocks > nr_pages)
>  				nr_blocks = nr_pages;
--
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