[lc-checkins] CVS: linux/mm/comp_cache adaptivity.c,1.29,1.30 main.c,1.48,1.49
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-06-27 13:17:41
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache In directory usw-pr-cvs1:/tmp/cvs-serv1474/mm/comp_cache Modified Files: adaptivity.c main.c Log Message: Bug fix: o Fixed potential bug when initializing a new comp page. It wasn't checked if the slab cache allocation had failed, so it could oops due to a null pointer. Index: adaptivity.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/adaptivity.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** adaptivity.c 25 Jun 2002 14:34:07 -0000 1.29 --- adaptivity.c 27 Jun 2002 13:17:37 -0000 1.30 *************** *** 2,6 **** * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-06-25 10:32:29 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-06-27 09:32:53 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 634,638 **** return 0; ! init_comp_page(&comp_page, page); comp_cache_freeable_space += PAGE_SIZE; --- 634,641 ---- return 0; ! if (!init_comp_page(&comp_page, page)) { ! page_cache_release(page); ! return 0; ! } comp_cache_freeable_space += PAGE_SIZE; Index: main.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -r1.48 -r1.49 *** main.c 25 Jun 2002 14:34:07 -0000 1.48 --- main.c 27 Jun 2002 13:17:37 -0000 1.49 *************** *** 2,6 **** * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-06-24 18:14:59 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-06-27 09:31:15 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 268,273 **** LIST_HEAD(lru_queue); ! inline void init_comp_page(struct comp_cache_page ** comp_page,struct page * page) { ! *comp_page = alloc_comp_cache(); (*comp_page)->free_space = PAGE_SIZE; (*comp_page)->free_offset = 0; --- 268,278 ---- LIST_HEAD(lru_queue); ! inline int ! init_comp_page(struct comp_cache_page ** comp_page,struct page * page) { ! *comp_page = alloc_comp_cache(); ! ! if (!(*comp_page)) ! return 0; ! (*comp_page)->free_space = PAGE_SIZE; (*comp_page)->free_offset = 0; *************** *** 275,278 **** --- 280,284 ---- INIT_LIST_HEAD(&((*comp_page)->fragments)); add_comp_page_to_hash_table((*comp_page)); + return 1; } *************** *** 320,324 **** for (i = 0; i < num_comp_pages; i++) { page = alloc_page(GFP_KERNEL); ! init_comp_page(&comp_page, page); } comp_cache_free_space = num_comp_pages * PAGE_SIZE; --- 326,332 ---- for (i = 0; i < num_comp_pages; i++) { page = alloc_page(GFP_KERNEL); ! ! if (!init_comp_page(&comp_page, page)) ! page_cache_release(page); } comp_cache_free_space = num_comp_pages * PAGE_SIZE; |