@@ -58,22 +58,24 @@ static inline void hibernate_restore_protection_end(void)
58
58
hibernate_restore_protection_active = false;
59
59
}
60
60
61
- static inline void hibernate_restore_protect_page (void * page_address )
61
+ static inline int __must_check hibernate_restore_protect_page (void * page_address )
62
62
{
63
63
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 ;
65
66
}
66
67
67
- static inline void hibernate_restore_unprotect_page (void * page_address )
68
+ static inline int hibernate_restore_unprotect_page (void * page_address )
68
69
{
69
70
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 ;
71
73
}
72
74
#else
73
75
static inline void hibernate_restore_protection_begin (void ) {}
74
76
static 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 ; }
77
79
#endif /* CONFIG_STRICT_KERNEL_RWX && CONFIG_ARCH_HAS_SET_MEMORY */
78
80
79
81
@@ -2832,7 +2834,9 @@ int snapshot_write_next(struct snapshot_handle *handle)
2832
2834
}
2833
2835
} else {
2834
2836
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 ;
2836
2840
handle -> buffer = get_buffer (& orig_bm , & ca );
2837
2841
if (IS_ERR (handle -> buffer ))
2838
2842
return PTR_ERR (handle -> buffer );
@@ -2858,15 +2862,18 @@ int snapshot_write_next(struct snapshot_handle *handle)
2858
2862
* stored in highmem. Additionally, it recycles bitmap memory that's not
2859
2863
* necessary any more.
2860
2864
*/
2861
- void snapshot_write_finalize (struct snapshot_handle * handle )
2865
+ int snapshot_write_finalize (struct snapshot_handle * handle )
2862
2866
{
2867
+ int error ;
2868
+
2863
2869
copy_last_highmem_page ();
2864
- hibernate_restore_protect_page (handle -> buffer );
2870
+ error = hibernate_restore_protect_page (handle -> buffer );
2865
2871
/* Do that only if we have loaded the image entirely */
2866
2872
if (handle -> cur > 1 && handle -> cur > nr_meta_pages + nr_copy_pages + nr_zero_pages ) {
2867
2873
memory_bm_recycle (& orig_bm );
2868
2874
free_highmem_data ();
2869
2875
}
2876
+ return error ;
2870
2877
}
2871
2878
2872
2879
int snapshot_image_loaded (struct snapshot_handle * handle )
0 commit comments