@@ -58,22 +58,24 @@ static inline void hibernate_restore_protection_end(void)
5858 hibernate_restore_protection_active = false;
5959}
6060
61- static inline void hibernate_restore_protect_page (void * page_address )
61+ static inline int __must_check hibernate_restore_protect_page (void * page_address )
6262{
6363 if (hibernate_restore_protection_active )
64- set_memory_ro ((unsigned long )page_address , 1 );
64+ return set_memory_ro ((unsigned long )page_address , 1 );
65+ return 0 ;
6566}
6667
67- static inline void hibernate_restore_unprotect_page (void * page_address )
68+ static inline int hibernate_restore_unprotect_page (void * page_address )
6869{
6970 if (hibernate_restore_protection_active )
70- set_memory_rw ((unsigned long )page_address , 1 );
71+ return set_memory_rw ((unsigned long )page_address , 1 );
72+ return 0 ;
7173}
7274#else
7375static inline void hibernate_restore_protection_begin (void ) {}
7476static inline void hibernate_restore_protection_end (void ) {}
75- static inline void hibernate_restore_protect_page (void * page_address ) {}
76- static inline void hibernate_restore_unprotect_page (void * page_address ) {}
77+ static inline int __must_check hibernate_restore_protect_page (void * page_address ) {return 0 ; }
78+ static inline int hibernate_restore_unprotect_page (void * page_address ) {return 0 ; }
7779#endif /* CONFIG_STRICT_KERNEL_RWX && CONFIG_ARCH_HAS_SET_MEMORY */
7880
7981
@@ -2832,7 +2834,9 @@ int snapshot_write_next(struct snapshot_handle *handle)
28322834 }
28332835 } else {
28342836 copy_last_highmem_page ();
2835- hibernate_restore_protect_page (handle -> buffer );
2837+ error = hibernate_restore_protect_page (handle -> buffer );
2838+ if (error )
2839+ return error ;
28362840 handle -> buffer = get_buffer (& orig_bm , & ca );
28372841 if (IS_ERR (handle -> buffer ))
28382842 return PTR_ERR (handle -> buffer );
@@ -2858,15 +2862,18 @@ int snapshot_write_next(struct snapshot_handle *handle)
28582862 * stored in highmem. Additionally, it recycles bitmap memory that's not
28592863 * necessary any more.
28602864 */
2861- void snapshot_write_finalize (struct snapshot_handle * handle )
2865+ int snapshot_write_finalize (struct snapshot_handle * handle )
28622866{
2867+ int error ;
2868+
28632869 copy_last_highmem_page ();
2864- hibernate_restore_protect_page (handle -> buffer );
2870+ error = hibernate_restore_protect_page (handle -> buffer );
28652871 /* Do that only if we have loaded the image entirely */
28662872 if (handle -> cur > 1 && handle -> cur > nr_meta_pages + nr_copy_pages + nr_zero_pages ) {
28672873 memory_bm_recycle (& orig_bm );
28682874 free_highmem_data ();
28692875 }
2876+ return error ;
28702877}
28712878
28722879int snapshot_image_loaded (struct snapshot_handle * handle )
0 commit comments