swsusp: don't pass a stack address to blkdev_get_by_path
holder is just an on-stack pointer that can easily be reused by other calls, replace it with a static variable that doesn't change. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Link: https://lore.kernel.org/r/20230608110258.189493-12-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
7ee34cbc29
commit
c889d0793d
@ -1510,6 +1510,8 @@ end:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *swsusp_holder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swsusp_check - Check for swsusp signature in the resume device
|
* swsusp_check - Check for swsusp signature in the resume device
|
||||||
*/
|
*/
|
||||||
@ -1517,14 +1519,13 @@ end:
|
|||||||
int swsusp_check(bool snapshot_test)
|
int swsusp_check(bool snapshot_test)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
void *holder;
|
|
||||||
fmode_t mode = FMODE_READ;
|
fmode_t mode = FMODE_READ;
|
||||||
|
|
||||||
if (snapshot_test)
|
if (snapshot_test)
|
||||||
mode |= FMODE_EXCL;
|
mode |= FMODE_EXCL;
|
||||||
|
|
||||||
hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device,
|
hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device,
|
||||||
mode, &holder, NULL);
|
mode, &swsusp_holder, NULL);
|
||||||
if (!IS_ERR(hib_resume_bdev)) {
|
if (!IS_ERR(hib_resume_bdev)) {
|
||||||
set_blocksize(hib_resume_bdev, PAGE_SIZE);
|
set_blocksize(hib_resume_bdev, PAGE_SIZE);
|
||||||
clear_page(swsusp_header);
|
clear_page(swsusp_header);
|
||||||
|
Loading…
Reference in New Issue
Block a user