Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96E47331202 for ; Fri, 20 Feb 2026 12:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771589136; cv=none; b=dAR7e2weT6TgfJOAN3P7hoCUszolO2Fjx9WiMIi5TbUk8J4Wzm4xzo5mD0+l6smxeBrEHefHZW91trys8iwEPN/oQqEtN1RE45VdJiMrdaH15qL0Qez65aFw8IUe6t8lD/eSUpsJTzvg/F5Zs7kXVwy9LJCQDdZT6d/qY8qEOi0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771589136; c=relaxed/simple; bh=BFzf4ZEybqxL8EpxRzC4oe9B5qzbMKXKgoYF1SVWZDU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VdGUw4EkdvTPNPmwY6GvsjKDBqtNlh8wEGSgY3ZcToNCurFh1uO7fvnv/jcVL55GTJF/51aPfA1Q3HJPQLgbbEKfwADrO5MH5rQvJxWuhF7PtR9neNrBFViD93rlsjsrz4Wpsq1uHPuoBldhx0J4dRLGhBMMBBo45iQbYHE8NC4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=b9yAVAau; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="b9yAVAau" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UN0zL/YMxGHwYKC13Bueav2dLNuSs7rxz4ORFuqjyQc=; b=b9yAVAauVff/rCkkDxoWF6bMg8 +/Me9Kf4+Dj+axo2KF28lTVPE2Thu7bElSX0+C/k+O0bdEpiMmU7cJoKghBPNJm77U01secXiVyr6 Xzx0SkgnlY7n4c6WhIpSWA86wEAf5H+yFKGQqTjDHae9ZxgldwCUUSlTi/9afONDO3k/oMUmWgGUK Il3+XX1/4FsqEMuq4QrxCurwNSXMB/9O1eXZz9rWOC8dkUEI1Mlhs3LHMy4Ld7N1HNDgiHoRo8Fb/ 3u2o00jAGQ1r0BkP/cjWLqiMwCo2lpG3KzkiTyFNMwyzCbdN2sAl+CT8Fq5E4FS5IkxIFIs4nj60x mF4/jB3g==; Received: from [90.240.106.137] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vtPGH-002uzR-O4; Fri, 20 Feb 2026 13:05:33 +0100 From: Tvrtko Ursulin To: criu@lists.linux.dev Cc: David Francis , Tvrtko Ursulin Subject: [RFC 12/26] plugins/amdgpu: Add error handling for seek operations Date: Fri, 20 Feb 2026 12:05:00 +0000 Message-ID: <20260220120514.4540-13-tvrtko.ursulin@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260220120514.4540-1-tvrtko.ursulin@igalia.com> References: <20260220120514.4540-1-tvrtko.ursulin@igalia.com> Precedence: bulk X-Mailing-List: criu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Extra safety so the calls do not stick out as the only ones with no error checking. Signed-off-by: Tvrtko Ursulin --- plugins/amdgpu/amdgpu_plugin.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index 1b531f351c55..06df63de2434 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -2297,6 +2297,11 @@ void *parallel_restore_bo_contents(void *_thread_data) goto err_sdma; } offset = ftell(bo_contents_fp); + if (offset < 0) { + ret = -errno; + pr_perror("Failed to alloc aligned memory. Consider setting KFD_MAX_BUFFER_SIZE."); + goto err_sdma; + } posix_memalign(&buffer, sysconf(_SC_PAGE_SIZE), buffer_size); if (!buffer) { @@ -2310,7 +2315,13 @@ void *parallel_restore_bo_contents(void *_thread_data) continue; entry = &restore_cmd->entries[i]; - fseeko(bo_contents_fp, entry->read_offset + offset, SEEK_SET); + ret = fseeko(bo_contents_fp, entry->read_offset + offset, + SEEK_SET); + if (ret < 0) { + ret = -errno; + pr_err("Failed to seek for BO using sDMA: bo_buckets[%d]\n", i); + goto err_sdma; + } ret = sdma_copy_bo(restore_cmd->fds_write[entry->write_id], entry->size, bo_contents_fp, buffer, buffer_size, h_dev, max_copy_size, SDMA_OP_VRAM_WRITE, false); -- 2.52.0