mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	[PATCH] swsusp: do not use memcpy for snapshotting memory
swsusp should not use memcpy for snapshotting memory, because on some architectures memcpy may increase preempt_count (i386 does this when CONFIG_X86_USE_3DNOW is set). Then, as a result, wrong value of preempt_count is stored in the image. Replace memcpy in copy_data_pages with an open-coded loop. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
		
							parent
							
								
									7ba1c6c88c
								
							
						
					
					
						commit
						95018f7c94
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		|  | @ -227,11 +227,17 @@ static void copy_data_pages(struct pbe *pblist) | |||
| 		for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) { | ||||
| 			if (saveable(zone, &zone_pfn)) { | ||||
| 				struct page *page; | ||||
| 				long *src, *dst; | ||||
| 				int n; | ||||
| 
 | ||||
| 				page = pfn_to_page(zone_pfn + zone->zone_start_pfn); | ||||
| 				BUG_ON(!pbe); | ||||
| 				pbe->orig_address = (unsigned long)page_address(page); | ||||
| 				/* copy_page is not usable for copying task structs. */ | ||||
| 				memcpy((void *)pbe->address, (void *)pbe->orig_address, PAGE_SIZE); | ||||
| 				/* copy_page and memcpy are not usable for copying task structs. */ | ||||
| 				dst = (long *)pbe->address; | ||||
| 				src = (long *)pbe->orig_address; | ||||
| 				for (n = PAGE_SIZE / sizeof(long); n; n--) | ||||
| 					*dst++ = *src++; | ||||
| 				pbe = pbe->next; | ||||
| 			} | ||||
| 		} | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Rafael J. Wysocki
						Rafael J. Wysocki