From patchwork Thu Jul 25 16:37:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 169725 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp11865477ilk; Thu, 25 Jul 2019 09:37:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwY2zfYzc0duR+Rl1dp1xycTKlCPXwMiSAz6YzUAF96fnxVCI6H/Y7m9moxg/ZblyoI/Fk X-Received: by 2002:a67:2e97:: with SMTP id u145mr56388202vsu.193.1564072643558; Thu, 25 Jul 2019 09:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564072643; cv=none; d=google.com; s=arc-20160816; b=qX2t26TFYW0iV1JDxipoYaXP0Z2MI8SgF+sPffaTMFRho7iDhAcL6rUWCe1+cu8D66 erIgbkp4MTjnC1uMyJJsbpjO9620TKi59TsMYUnTf+qoQuM8RpuoKjOl0ncFpN51i7di v0T4WB8VXiL/rdF5cermAt6yXr2eA5fTJ4/2D2Bp7Qg8ZNwje50yMiHqvFbGQ9Sbzmtu UyileXLySUdauzkMrXwJ4uIP3xGIUiqWthmsgvDRwpvs8L9Mv51Y0if9TBCMIAOCrVHp AkE7FTC2d/+K35iihLLiEoViQWM5tFNcQ31cSProwjAV9nfUpQ5gTZu13aurcZpWPkoH fMLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=yM6cVpuxn4Ke92kaJ4AKkVK8RWiK/GxhKcUyMJM8z1M=; b=fToYdE9+lfcrBURqn9NcykeFAvaxYqoh7z8Yv8ohuhUbun9klQe+BgUY0h6RoMIYsg sTN/hGWmLD2b0ouGenIwfQ+TXybbh0+ZNBmesMqJndTdB26z9EF23e4WBH8PmZhnvTdj EMuQJDmK9tDllqj3L85aaNSsUwvPKSS6hr5ku8Xr5C1/QF+5b4JmBP9KVcwM6CvAFAeD MCPZSdx/oG1kXHJKOrvcr1x+bmGpwIC7JW177SE8lZPVQXCrj+ZYER1K8MijZoks1gRL LDuxwA+/1MepWDUstubEAX09o6n8cOD6i0V4nK9WM2Ie3lDOOUaTIUa3FvgQZwqWOzFH SKbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DjFVat4F; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z11si9984481vkb.78.2019.07.25.09.37.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Jul 2019 09:37:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DjFVat4F; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqgk6-0004cC-Qb for patch@linaro.org; Thu, 25 Jul 2019 12:37:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48366) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqgk0-0004bY-H9 for qemu-devel@nongnu.org; Thu, 25 Jul 2019 12:37:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqgjz-0007EZ-CJ for qemu-devel@nongnu.org; Thu, 25 Jul 2019 12:37:16 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:55848) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hqgjz-0007DE-68 for qemu-devel@nongnu.org; Thu, 25 Jul 2019 12:37:15 -0400 Received: by mail-wm1-x341.google.com with SMTP id a15so45582588wmj.5 for ; Thu, 25 Jul 2019 09:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yM6cVpuxn4Ke92kaJ4AKkVK8RWiK/GxhKcUyMJM8z1M=; b=DjFVat4FH98pFLbbLk+slSWzmsHNOwovfvZGBlQivOkRG7faTKI4L17ghY1gr0OT8e dEyxzQp+sEZb3zmxy7p4NEuXHEF7dcSOCLREPlVQlAj4jq2CTp1s8Z7uawZ5Y70Ri3Pt FAJhHPaygvT7rEL4jNOQhJOjPqvDTSIo30Le3qdEd+D1Vkona5/NouCdJx7jMD4A/l9F iVLcDOn56kRqGdAVpTDhCTP7hQBJgih1aaeC011DEupvIoEerSecl/hO2aNq2+/HFQFP FDbau2qt4aMqfbZl/VGXpo/Zfh+LzDy01qmuQ7L+Bo8wrBo+rgFpZ7IWU8Kuz02NG5CZ W4Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yM6cVpuxn4Ke92kaJ4AKkVK8RWiK/GxhKcUyMJM8z1M=; b=F3PUCcFM2EDAF1DzV+SpxO5J1c/9vVuTeqOWWvA1CIJiUPspjSyrIJ7MZWUobffbzA 9QhaOfZwqf3+mbzE/WHSpwULg7LdvJsQduVryuH8nN6c3sTFKdDKhKCfk9miKmMyvVnz CXyZeHh7G10KULCZH+0ZcBQtECuvMLOpEsh/LUk+6tuTcq2GGuv3/KBtpGruSjijvxaw 2vSmczx6lLsGmLjgwccs82fneKWoUA0ppjZKwFCQJUJb3RI20vu99fosNImtE59/r9Gm 3jjWLGKJ4nHxdDa5uD89LcJsUye8QDXFwdVMgWv0nujDzlIrHZSm35g9A0Hag42GhovB zxBw== X-Gm-Message-State: APjAAAUrpVpee70+0Yv08a30J2PfiTAFTwPjGk+XYTELA2NpB0Xz2Mjv znDZXosFX1VTemQUi0Ovsxs9ZRwROtD1NQ== X-Received: by 2002:a1c:7e85:: with SMTP id z127mr82974403wmc.95.1564072634239; Thu, 25 Jul 2019 09:37:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c7sm44125140wro.70.2019.07.25.09.37.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 25 Jul 2019 09:37:13 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Thu, 25 Jul 2019 17:37:09 +0100 Message-Id: <20190725163710.11703-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190725163710.11703-1-peter.maydell@linaro.org> References: <20190725163710.11703-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH for-4.1? 1/2] stellaris_input: Fix vmstate description of buttons field X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" gamepad_state::buttons is a pointer to an array of structs, not an array of structs, so should be declared in the vmstate with VMSTATE_STRUCT_VARRAY_POINTER_INT32; otherwise we corrupt memory on incoming migration. We bump the vmstate version field as the easiest way to deal with the migration break, since migration wouldn't have worked reliably before anyway. Signed-off-by: Peter Maydell --- hw/input/stellaris_input.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.20.1 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Damien Hedde diff --git a/hw/input/stellaris_input.c b/hw/input/stellaris_input.c index 20c87d86f40..3a666d61d47 100644 --- a/hw/input/stellaris_input.c +++ b/hw/input/stellaris_input.c @@ -60,12 +60,14 @@ static const VMStateDescription vmstate_stellaris_button = { static const VMStateDescription vmstate_stellaris_gamepad = { .name = "stellaris_gamepad", - .version_id = 1, - .minimum_version_id = 1, + .version_id = 2, + .minimum_version_id = 2, .fields = (VMStateField[]) { VMSTATE_INT32(extension, gamepad_state), - VMSTATE_STRUCT_VARRAY_INT32(buttons, gamepad_state, num_buttons, 0, - vmstate_stellaris_button, gamepad_button), + VMSTATE_STRUCT_VARRAY_POINTER_INT32(buttons, gamepad_state, + num_buttons, + vmstate_stellaris_button, + gamepad_button), VMSTATE_END_OF_LIST() } };