From nobody Tue Apr 21 14:38:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1776687064; cv=none; d=zohomail.com; s=zohoarc; b=fg5axhlG4BQhuwTyKb1vKnw4DtdP9z7DPXUy/TL7DfuxcZngemhBbv5iGR2ZPXKr2/0i9+dravRZGd0+SNTaKi4RKoaei3OeKh8Es/RKMlm5um78mbr3OZvzSpxLA4ZH7sik6BICXLStZoZQHbxMaCtuhXWGIS2mIuUydkuSKNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776687064; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QSq7bPQMAxTuQb8daEQdU5mrxgkxeioOXsWsrzTbjeU=; b=XK9HJjae0NDzUuaPsHGqFN5jd+3DaQ6o3Q9YsByDIc/YAdTDhprbn+RSsXlphExQ8F5bFKTO/qtrv2DHDa4SHPut4sRb2R8yv8VkzxBXrzUzkor/4AKSJLWoCTGr/pvAxd7p9vRf4mJGybuY5U+JtRm1YO/8g+pjKt/U1fWwKL8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17766870645212.222554164136568; Mon, 20 Apr 2026 05:11:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEnSP-00069T-7Q; Mon, 20 Apr 2026 08:10:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEnSK-00066J-57 for qemu-devel@nongnu.org; Mon, 20 Apr 2026 08:10:25 -0400 Received: from mgamail.intel.com ([198.175.65.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEnSH-0004MY-Cv for qemu-devel@nongnu.org; Mon, 20 Apr 2026 08:10:23 -0400 Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2026 05:10:20 -0700 Received: from junjie-optiplex-micro-plus-7010.bj.intel.com ([10.238.152.98]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2026 05:10:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1776687022; x=1808223022; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=co6/EQDKeNJbkhw8y9V//WgV6dqwIupeKLjGfA2y7iY=; b=SXEpMtJ5UqQxpMdbPkGyM0+hY/IqfHSVzFrAWGrzu67P+BTxNVtOZ9p3 6Oma0RvlmMYuHR4bYck1SaqYBFVkQdo130jP9GssHEWsDZl1fmQyUPpsb OJiMKk8iqYHk5YNyMzj/SjE2zywSLOR9akahNkPOthXrWfpm5WVqEeeaC a1CMM5G5+diazWJPzHNV2a5GpH0LHAnJSUhanlWlS2dG1asM8ohuLH6Hk khOxnji10zNMJqXY40P6hXtBLC8P2Kuog4iiqYiCbKPGoHKJpHJ58GaEC dZvRoTxD3X30i8KxVzxzg1FJcd5W5LZ3V3izaUcBbb2WJpxRvW7PMJgpN Q==; X-CSE-ConnectionGUID: dnb50RiMSTejaZSkqJdhUA== X-CSE-MsgGUID: Ne/jMz14Q3yXDA6BXyCtVg== X-IronPort-AV: E=McAfee;i="6800,10657,11762"; a="88674219" X-IronPort-AV: E=Sophos;i="6.23,189,1770624000"; d="scan'208";a="88674219" X-CSE-ConnectionGUID: KwNelD88S9S0NFWqQHEElg== X-CSE-MsgGUID: 8JVGcnV3QB+kHj3nYjU63Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,189,1770624000"; d="scan'208";a="235708261" From: Junjie Cao To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, junjie.cao@intel.com Subject: [PATCH 1/3] migration/qemu-file: switch buffer_at functions to positioned I/O _all helpers Date: Tue, 21 Apr 2026 04:13:15 +0800 Message-ID: <20260420201317.30199-2-junjie.cao@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260420201317.30199-1-junjie.cao@intel.com> References: <20260420201317.30199-1-junjie.cao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=198.175.65.13; envelope-from=junjie.cao@intel.com; helo=mgamail.intel.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_FUTURE_06_12=1.947, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1776687067132158500 Content-Type: text/plain; charset="utf-8" qemu_put_buffer_at() and qemu_get_buffer_at() have the same pattern as the bug fixed in multifd_file_recv_data(): the ssize_t return value from the channel layer is stored in a size_t variable, and a short transfer would be mishandled rather than retried. Switch to qio_channel_pwrite_all() / qio_channel_pread_all() which handle short transfers internally and make the code more robust and consistent with the rest of the positioned I/O call sites. Fixes: 7f5b50a401 ("migration/qemu-file: add utility methods for working wi= th seekable channels") Signed-off-by: Junjie Cao Reviewed-by: Peter Xu --- migration/qemu-file.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 9cf7dc3bd5..9dfb202203 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -535,28 +535,13 @@ void qemu_put_buffer_at(QEMUFile *f, const uint8_t *b= uf, size_t buflen, off_t pos) { Error *err =3D NULL; - size_t ret; =20 if (f->last_error) { return; } =20 qemu_fflush(f); - ret =3D qio_channel_pwrite(f->ioc, (char *)buf, buflen, pos, &err); - - if (err) { - qemu_file_set_error_obj(f, -EIO, err); - return; - } - - if ((ssize_t)ret =3D=3D QIO_CHANNEL_ERR_BLOCK) { - qemu_file_set_error_obj(f, -EAGAIN, NULL); - return; - } - - if (ret !=3D buflen) { - error_setg(&err, "Partial write of size %zu, expected %zu", ret, - buflen); + if (qio_channel_pwrite_all(f->ioc, buf, buflen, pos, &err) < 0) { qemu_file_set_error_obj(f, -EIO, err); return; } @@ -569,31 +554,17 @@ size_t qemu_get_buffer_at(QEMUFile *f, const uint8_t = *buf, size_t buflen, off_t pos) { Error *err =3D NULL; - size_t ret; =20 if (f->last_error) { return 0; } =20 - ret =3D qio_channel_pread(f->ioc, (char *)buf, buflen, pos, &err); - - if ((ssize_t)ret =3D=3D -1 || err) { + if (qio_channel_pread_all(f->ioc, (char *)buf, buflen, pos, &err) < 0)= { qemu_file_set_error_obj(f, -EIO, err); return 0; } =20 - if ((ssize_t)ret =3D=3D QIO_CHANNEL_ERR_BLOCK) { - qemu_file_set_error_obj(f, -EAGAIN, NULL); - return 0; - } - - if (ret !=3D buflen) { - error_setg(&err, "Partial read of size %zu, expected %zu", ret, bu= flen); - qemu_file_set_error_obj(f, -EIO, err); - return 0; - } - - return ret; + return buflen; } =20 void qemu_set_offset(QEMUFile *f, off_t off, int whence) --=20 2.43.0 From nobody Tue Apr 21 14:38:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1776687095; cv=none; d=zohomail.com; s=zohoarc; b=VlxR3p1yyVNrSsn+4gD69P+8COpFwwYMetdffP/rrnZHJnJNJS0yQJ4dtNKiVZhadZT4R2dNpUa/JsWekGOuactYYeqK8+Jc/ynrIbSHR6lgQsz2ALIrECzVGoOvl2UKOQKuSodwU5i17zmGea/B5Py+gufvm8B00RQN2gD8uKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776687095; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I9zybjoW2od/Zq1O2F4Y4JWwqkiiMTH2mL69kan7kQQ=; b=OI39HgprZ6WvAMBgrIVneU6alYGNRmTS7P/K7M8Hi0DYVa/IzoZpt8jbvxLCnrt7SAPqYP1rGrn2HCEcUWnIWDQ0kkJGZYzfp1nkO6Z4Z8PBepUP4snLocIP0TvB3ofJXO6+RuUCswAd7CZyF5gu07DnMdHzM+0XWz6FS7unp6M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776687090001130.3541012203043; Mon, 20 Apr 2026 05:11:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEnSd-0006Fi-1f; Mon, 20 Apr 2026 08:10:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEnSR-0006FD-2D for qemu-devel@nongnu.org; Mon, 20 Apr 2026 08:10:31 -0400 Received: from mgamail.intel.com ([198.175.65.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEnSP-0004Rl-EH for qemu-devel@nongnu.org; Mon, 20 Apr 2026 08:10:30 -0400 Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2026 05:10:29 -0700 Received: from junjie-optiplex-micro-plus-7010.bj.intel.com ([10.238.152.98]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2026 05:10:27 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1776687030; x=1808223030; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CUDka3bP53CRZaZv32S7MqGXZ/SM72d8bEpuI1Piopo=; b=ItEY6DrrQqCXTvVGELAfMRomF4dm3hwZyOAzF9qQZUCEiQzHFYXdpmrO 5iyu67jPt7u5m8Ff2fPgditcQ43937kMW4eJ4TfqL8fwGww+Cc+ed8Myg 1Za/kmsmxEbcmrz2cMNE0Ztqn1JTdCmZPdvXa1/2cEXSkxgEm+Wu8ewYd KooYwIHacBTw5ORWv/CTwsFDQ3v0RwZNhhH8VC4Ev//APYI2bWhop1QIG 1+EAw8uAVNtM5SFVu1yiZ7PuENN9wFLtN8kk7MX5Sez+VSnKg/owH7wtm lxL3S3A9RfSmeOUpMAnzVSwncrWAssRjSofdBXIa8+IxXUHgCvsV8dPg2 A==; X-CSE-ConnectionGUID: NJ/yu9czScqvlmYg5useOQ== X-CSE-MsgGUID: REwC9txnQNePC5zRVwpl4g== X-IronPort-AV: E=McAfee;i="6800,10657,11762"; a="88674250" X-IronPort-AV: E=Sophos;i="6.23,189,1770624000"; d="scan'208";a="88674250" X-CSE-ConnectionGUID: ZAxxBapDSL2tunq1GIsgbg== X-CSE-MsgGUID: n/4TiuQ2SO6jNX998X1NEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,189,1770624000"; d="scan'208";a="235708274" From: Junjie Cao To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, junjie.cao@intel.com Subject: [PATCH 2/3] migration/file: switch file_write_ramblock_iov to pwritev_all Date: Tue, 21 Apr 2026 04:13:16 +0800 Message-ID: <20260420201317.30199-3-junjie.cao@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260420201317.30199-1-junjie.cao@intel.com> References: <20260420201317.30199-1-junjie.cao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=198.175.65.13; envelope-from=junjie.cao@intel.com; helo=mgamail.intel.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_FUTURE_06_12=1.947, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1776687095374158500 Content-Type: text/plain; charset="utf-8" file_write_ramblock_iov() uses single-shot qio_channel_pwritev() and only checks for ret < 0. A short write (0 <=3D ret < requested) would be treated as success. Switch to qio_channel_pwritev_all() which retries until all bytes are written or an error occurs. Fixes: f427d90b98 ("migration/multifd: Support outgoing mapped-ram stream f= ormat") Signed-off-by: Junjie Cao Reviewed-by: Peter Xu --- migration/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/file.c b/migration/file.c index 0853188601..3729728dfe 100644 --- a/migration/file.c +++ b/migration/file.c @@ -200,7 +200,7 @@ void file_connect_incoming(FileMigrationArgs *file_args= , Error **errp) int file_write_ramblock_iov(QIOChannel *ioc, const struct iovec *iov, int niov, MultiFDPages_t *pages, Error **errp) { - ssize_t ret =3D 0; + int ret =3D 0; int i, slice_idx, slice_num; uintptr_t base, next, offset; size_t len; @@ -239,8 +239,8 @@ int file_write_ramblock_iov(QIOChannel *ioc, const stru= ct iovec *iov, break; } =20 - ret =3D qio_channel_pwritev(ioc, &iov[slice_idx], slice_num, - block->pages_offset + offset, errp); + ret =3D qio_channel_pwritev_all(ioc, &iov[slice_idx], slice_num, + block->pages_offset + offset, errp); if (ret < 0) { break; } @@ -249,7 +249,7 @@ int file_write_ramblock_iov(QIOChannel *ioc, const stru= ct iovec *iov, slice_num =3D 0; } =20 - return (ret < 0) ? ret : 0; + return ret; } =20 int multifd_file_recv_data(MultiFDRecvParams *p, Error **errp) --=20 2.43.0 From nobody Tue Apr 21 14:38:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1776687089; cv=none; d=zohomail.com; s=zohoarc; b=eqx6P1W9B4Au7+OzM0Wtd32DEnfUJBGwweTVBeepOFhijRKVIB9ZtPPtlw0IJ+9fcrI9GV8+4JRHBX5x7DL1qbV22r22IlJSex+Uzarw4yTLv1vO28NdSwGhxix4+UimFwsUj1/cwKPbc8BWJZPXqGiin7niL0d414OI1q6KxGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776687089; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8ehsDJ1xwDVxnHwudgls0mfGJa1USlCiTRITCudCaGA=; b=SU9pG8HlJqsT6rLhYsMjcWDA2k+sXYg+Bh3mx9l7VP2mzKVBt6eu66ZpFOx4AR4yyAwlIVw51RAZXDscTbqxRODCWI72dJAemUeTBQnLqzrC1tIJsF0xvQUCtbFn/WNeCliSWtgYPs+4fjFPH5YlocVFhKP/OinMccv7QeIvroI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776687089423189.30773360695457; Mon, 20 Apr 2026 05:11:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEnTF-0006be-Iv; Mon, 20 Apr 2026 08:11:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEnSW-0006HV-UW for qemu-devel@nongnu.org; Mon, 20 Apr 2026 08:10:41 -0400 Received: from mgamail.intel.com ([198.175.65.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEnSV-0004Rl-5h for qemu-devel@nongnu.org; Mon, 20 Apr 2026 08:10:36 -0400 Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2026 05:10:35 -0700 Received: from junjie-optiplex-micro-plus-7010.bj.intel.com ([10.238.152.98]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2026 05:10:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1776687036; x=1808223036; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FRDFZTXk/wsz+JehMsAdHWcXLCvo0ta2YnqKF+zvKDE=; b=J6WC+/9QXdkFBTxlopngrVaIb+3Pn2A7b8Fd4T+N31RY8zpZ7Y9ZWNGt y2q/hWk1NWxioZe+G7KFc5ugHLkaEw1xM9bwbVoabdCvz9P9fC4joDK1d ongSJ29csNFcthZwTZHWE4Gi/BnXZ6tSab4E+0sFZVhr+04EF69ykVFCF iXYUs+X/NSHUwuX/R5dFnbwC07Fim5IrSoTxbARn59ZGgSAvcq92a+Tqb 1buNECtE5lVQO9NVKmwmuT7R3JcUe+HB0TIdMTeqDhPO65CmA00PdQOjT yFuEo2cAttVeEKwDNtDt5sZVnjn48w2x7GSc3kmH5edjrXQUeSYlOX3+u g==; X-CSE-ConnectionGUID: Mlu0mJGSQI+qcD8g5BblLA== X-CSE-MsgGUID: qN3uVjSBSQeF/4UeCyCVzg== X-IronPort-AV: E=McAfee;i="6800,10657,11762"; a="88674256" X-IronPort-AV: E=Sophos;i="6.23,189,1770624000"; d="scan'208";a="88674256" X-CSE-ConnectionGUID: p0+IrDa3SFCWxpDZ3XGolA== X-CSE-MsgGUID: gfrZWsBTTf+5knFCofey6Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,189,1770624000"; d="scan'208";a="235708280" From: Junjie Cao To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, junjie.cao@intel.com Subject: [PATCH 3/3] migration/qemu-file: drop incorrect const from qemu_get_buffer_at buf Date: Tue, 21 Apr 2026 04:13:17 +0800 Message-ID: <20260420201317.30199-4-junjie.cao@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260420201317.30199-1-junjie.cao@intel.com> References: <20260420201317.30199-1-junjie.cao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=198.175.65.13; envelope-from=junjie.cao@intel.com; helo=mgamail.intel.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_FUTURE_06_12=1.947, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1776687092398154100 Content-Type: text/plain; charset="utf-8" qemu_get_buffer_at() reads data *into* buf -- it should not be const. Drop the qualifier and remove the now-unnecessary cast. Signed-off-by: Junjie Cao Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- migration/qemu-file.c | 4 ++-- migration/qemu-file.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 9dfb202203..d5a48115bd 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -550,7 +550,7 @@ void qemu_put_buffer_at(QEMUFile *f, const uint8_t *buf= , size_t buflen, } =20 =20 -size_t qemu_get_buffer_at(QEMUFile *f, const uint8_t *buf, size_t buflen, +size_t qemu_get_buffer_at(QEMUFile *f, uint8_t *buf, size_t buflen, off_t pos) { Error *err =3D NULL; @@ -559,7 +559,7 @@ size_t qemu_get_buffer_at(QEMUFile *f, const uint8_t *b= uf, size_t buflen, return 0; } =20 - if (qio_channel_pread_all(f->ioc, (char *)buf, buflen, pos, &err) < 0)= { + if (qio_channel_pread_all(f->ioc, buf, buflen, pos, &err) < 0) { qemu_file_set_error_obj(f, -EIO, err); return 0; } diff --git a/migration/qemu-file.h b/migration/qemu-file.h index a390554208..8f824c124d 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -76,7 +76,7 @@ void qemu_set_offset(QEMUFile *f, off_t off, int whence); off_t qemu_get_offset(QEMUFile *f); void qemu_put_buffer_at(QEMUFile *f, const uint8_t *buf, size_t buflen, off_t pos); -size_t qemu_get_buffer_at(QEMUFile *f, const uint8_t *buf, size_t buflen, +size_t qemu_get_buffer_at(QEMUFile *f, uint8_t *buf, size_t buflen, off_t pos); =20 QIOChannel *qemu_file_get_ioc(QEMUFile *file); --=20 2.43.0