From patchwork Thu Jun 20 15:22:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 805988 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp346281wrt; Thu, 20 Jun 2024 08:24:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXayem3SBXAzC3ofLVx6Vi71ytNQLPRA2XJfUL8GvXcf5q5Ap+igihJruRnOh2ryFLfg8HAioRYkAx/+y9T5zOa X-Google-Smtp-Source: AGHT+IHHRFViHUj7Tt1Pr3MfGKp2yeXROux6d+RDGgXclvtfZOCmRcUcLDqWNQQ7yPR20BRHviVw X-Received: by 2002:a05:622a:13d0:b0:43e:3c64:d3ed with SMTP id d75a77b69052e-444a79e16ecmr74158671cf.32.1718897081740; Thu, 20 Jun 2024 08:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897081; cv=none; d=google.com; s=arc-20160816; b=nFXde5KIdWnrUSZozmXj3HJ6ERA9Rzh7A6KQea5+V1WVFtfRV/+6xb6rRoLjBLY7BG i048RF0CVZqDZw6w3UMmZdVWR2L2sYuV9Msi+evaTeJHy2xHKdbScdyBvKb0Qo7PJD2D 91U7wDD+hKAFmsyYlrS4/MGWz3XXdZowMLOIW3ufVys8U4NSEwnEh0YihT7Zqf/d+MZQ iU98Ho8cFG5SvCq7o37XDv5mTyYJaU91euHzDUkjSoU6nfBbRhMqTmdoFGguI7ARrk7Q 9rM+aMA0LgDbFe2ljQS0CyGdb2nsvXhB1FyESihYL9ZsHuQ3LOD8gvb9THdsrjO+RrPW tpkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GJDItK1lJ7pU44CkysDABVIUb9quWUurAs3tDshcfJY=; fh=SR5xYl9zGhRHiWMHH7Y+z31fb0W/ZK3xNQA1gYblpLU=; b=eRmvqgXajrBt5b3IVGTZVNDz4EVIBGYYP8/vAChToWqq2dInOFp9QRgk6qvu5T6EfA qOzduKHQdBTHvp0NsIcTapgxRbvHgi40TgAC6nMCaaZ+rwlEIqlx/nCVemtlmoLUWTx1 XXnDsSagBZkLAiFAk2XL7Hlas4gQtv68Hs9bcs3jsaPxf5PYXdG7NsDPnlO0ruA34oYk Hm1hCglpC9iky9EBqpjDuP34KG2zWJKgehIjyvfbQjprK2InkU7iPLQpxanVXzouOdFE ix9JWmycjmvia0Lrtl6LRIrWxZFtlHtQHYoA95iobhchHxRiv2C8AFXJeNem0QcQycZW g6Zg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JQ9QJAAF; 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=pass (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 d75a77b69052e-441f2ff772bsi168158141cf.621.2024.06.20.08.24.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:24:41 -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=pass header.i=@linaro.org header.s=google header.b=JQ9QJAAF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcP-0005pv-Bb; Thu, 20 Jun 2024 11:22:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcN-0005of-8c for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:31 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcL-0007x7-KX for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:30 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-57d15b85a34so1204595a12.3 for ; Thu, 20 Jun 2024 08:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896948; x=1719501748; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GJDItK1lJ7pU44CkysDABVIUb9quWUurAs3tDshcfJY=; b=JQ9QJAAFPFPmroROCjiWION6Zc+40YqR1RJTI5pKkcc2/e188KLCYZ/MBLnC0Qvvd7 1drXd2pKKoA4PATTo5kRPcJlYLy+o4zx39Y67L9I1MejolRIU7hThnDUplijKN8/f6JF rMZGOzvk84yHiC6GYfw2baJMwtYJgtXs35Mp7m0oh9LCkrG5j4SB3LFYbZaxAbYGrgo4 FHUuIucSxDZ02a7SuI4jI8GnqZMPuqVNRg/PsflfpWsn1T2n9xm01tMMnCGGtG8EY08R Fzkvy9v8HdumUPYQjprRgd8JR2C7VH5v1jmT/PnP/YJ5NT5LUNApraM1u6dfK8SgeyFm n1WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896948; x=1719501748; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GJDItK1lJ7pU44CkysDABVIUb9quWUurAs3tDshcfJY=; b=sTPaWE6995LyT2JaV1AbGahJrcXmVANcqJjLQYKWzsUEZFjxTeddrjozmGqTl2ivVs crFvLzESCUkPsohgo9IJuEbYHXqmvDXoKK0BnEMPilstNue2ctzGo3dX5J6sbW3HcSvY SqVkhhbXHtD6qooN6s06vZ3yZHpGtdYIllhtmZ0ZgIFIOpGJ5VRZXtd0DEpdzl0Vqg6v 8nPc+Vp+BhWhN8k7xbMp6eO5xPswBizbRKSPmABhmfb2bQzuFpVDSNv9sWdWDR1/zgf1 e82q1A+8AnijiNibyrD+ZguxATTxDviAT4MOBJLUVJlV2/kbyPVlh84EQyCNnRBHnJ38 UHew== X-Gm-Message-State: AOJu0YyefX0ISJyFHJy7XKbwywugBm8nwP8c/rKQ58WdErJT7YeJYX5h K2PpeDDMQeqp+EZEVhixaVV2DV8iXq4CUN90TKgPNcP0hRYYiMD463BVjsTKOf0= X-Received: by 2002:a50:cd97:0:b0:57d:61a:7f20 with SMTP id 4fb4d7f45d1cf-57d07e6ba6cmr3862286a12.3.1718896948159; Thu, 20 Jun 2024 08:22:28 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57d16160c18sm1609800a12.26.2024.06.20.08.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:22 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 51EE45F9F4; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Akihiko Odaki Subject: [PATCH v2 03/12] plugins: Ensure register handles are not NULL Date: Thu, 20 Jun 2024 16:22:11 +0100 Message-Id: <20240620152220.2192768-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Ensure register handles are not NULL so that a plugin can assume NULL is invalid as a register handle. Signed-off-by: Akihiko Odaki Reviewed-by: Pierrick Bouvier Message-Id: <20240612153508.1532940-4-alex.bennee@linaro.org> Message-Id: <20240229-null-v1-1-e716501d981e@daynix.com> Signed-off-by: Alex Bennée --- plugins/api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/api.c b/plugins/api.c index 5a0a7f8c71..6bdb26bbe3 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -507,7 +507,7 @@ static GArray *create_register_handles(GArray *gdbstub_regs) } /* Create a record for the plugin */ - desc.handle = GINT_TO_POINTER(grd->gdb_reg); + desc.handle = GINT_TO_POINTER(grd->gdb_reg + 1); desc.name = g_intern_string(grd->name); desc.feature = g_intern_string(grd->feature_name); g_array_append_val(find_data, desc); @@ -528,7 +528,7 @@ int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray *buf) { g_assert(current_cpu); - return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg)); + return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); } struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_size)