From bd1cb390b3d330070f85fa94825e656d74489149 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sat, 16 Mar 2024 14:31:58 +0100 Subject: [PATCH] smart_shim: fix hibernation Signed-off-by: AuxXxilium --- shim/storage/smart_shim.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shim/storage/smart_shim.c b/shim/storage/smart_shim.c index a919e62..d76675f 100644 --- a/shim/storage/smart_shim.c +++ b/shim/storage/smart_shim.c @@ -684,8 +684,10 @@ static int handle_hdio_drive_cmd_ioctl(struct block_device *bdev, fmode_t mode, //Before we execute ioctl we need to save the original header as ioctl will override it (they share buffer) u8 req_header[HDIO_DRIVE_CMD_HDR_OFFSET]; if(unlikely(copy_from_user(req_header, buff_ptr, HDIO_DRIVE_CMD_HDR_OFFSET) != 0)) { - pr_loc_err("Expected to copy HDIO_DRIVE_CMD header of %d bytes from %p - it failed", HDIO_DRIVE_CMD_HDR_OFFSET, - buff_ptr); + if (buff_ptr != NULL) { + pr_loc_err("Expected to copy HDIO_DRIVE_CMD header of %d bytes from %p - it failed", HDIO_DRIVE_CMD_HDR_OFFSET, + buff_ptr); + } return -EIO; }