From nobody Mon Apr 6 15:50:40 2026 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0ECEA278156 for ; Thu, 19 Mar 2026 01:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773885268; cv=none; b=eoYsGCxJZFxBJqPdFf/obw47JrrKvOD6VK5hc8g3HPbYcm92hU/WcbI8wFc/38RNdHULGlHzNk5fyN97Wv2abRmjOhhj2tG7HuwKUsBNZN8EQam0RkHHu10wgdVO89b4nNopxaTcfx4gCyySDMEIYbf6ogWg9wpNRQ7dqC4slU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773885268; c=relaxed/simple; bh=Qh2vnbr/G0FbsYPFv/wdBgpWST+Ly6gdwfvFztr3eTI=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=hpCk6GT+X4Cf6cnnJJ8MKgHIfIPT8NJff0/YMJsKsdLisIQQAzbSxbA45GZtbegHaG1EiDdA3V568QoksupKvaJDYzNsDRw2xw8U/QLpXZXKrz8IqBnfunGbH6bbENZqqGzGT1H5k1AxLbHMH2pS0lXJhLmRYzvxYNE4r0rqW94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--morbo.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Y9WgyqSK; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--morbo.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Y9WgyqSK" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c7414179cceso409831a12.0 for ; Wed, 18 Mar 2026 18:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1773885263; x=1774490063; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=IphLt+X2YEUN0QZS0TcE47jvN82gWZ8dBXENMhkBUfg=; b=Y9WgyqSKxIkN48BRujBVy/1S8IHOlftywljq44SCm7bog5C3VgB3bMR8w+kzMu3PT8 l8Oldri9oJRxh7iuR/8nKJASdA25UdJEwOWOvX9B/W8E72KEaoANoCjgAM4ToCyXTa1w dE6UA3H5vFNTrKc7H+PpOpmmeGewKEpBwNt8xWI6q/VwWdlHftlFyg+2dQBu1RWNQWyk opwXrfXMPzG9E16os3PDzWhbUglqKpT7OnPcYUyYOzP5y5KmZC8BgvsqI025ymE1NSif EY5gUtl7VSzjvkgNWJnmjZZF5evvHjyeqDIgek/h+sy0bjrCUBCR5snFe9KPO18FRDGT 2gZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773885263; x=1774490063; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IphLt+X2YEUN0QZS0TcE47jvN82gWZ8dBXENMhkBUfg=; b=SwWCntHhJHr8RTy8twO0X93pI4PRKoswJauRLMcoKek/NbIj/mn8gueKaX4kR82vJ/ fMG91s8Ws+hnEgeSYGBWeKOXr8CtoEIIK2jl14pl8MCz5C9tPBnZKWFc68AmhJmznhkF 0sfaugY7zZuafVKwKrBmknnZB0WrX3ErrSCtcaced4BfxzJ8opIBn3qOi7f8rHmJMT38 Az6IPS2XpxVXTbcQEEfPYjJFwYyHld5G9RRUQBRQRNspGxJgxiFX+bnZ0lExpzFUoqZW ZYVDoGs9/VSBze6fMU3GeKh9ejZ7oWa55cI/NGoJ7HEDsktsjiIBekBoBqV5jwVi2u4W a+dg== X-Gm-Message-State: AOJu0Yw+KP9gDZLK4KoPKBAkVF8SlGcek6EV5ersC7M0Z8SnYVvMSraM hBkB+tXtM+IiHZYiUQKk1s/AkZjw/rxPTlu92tkGmsKeR/DAJ2wYaHdnQRfdB3Sj0gtXD3RLhbg jWttx4/uQaZS5a2Jrmero0MIJqvU0XmtuWlHUccgP6gLiTe7zqy1E79+zbAxUZcZjG84ie0KDUF 1QebYVW/RYSS5ZrtTL6bdRuuN7KEPA/mmaPdQzHg== X-Received: from pgbbz36.prod.google.com ([2002:a05:6a02:624:b0:c6e:1f6a:ef71]) (user=morbo job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:b84:b0:398:787c:d2e4 with SMTP id adf61e73a8af0-39b99d4bd9amr5301199637.17.1773885262711; Wed, 18 Mar 2026 18:54:22 -0700 (PDT) Date: Thu, 19 Mar 2026 01:54:10 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog Message-ID: <20260319015418.2871262-1-morbo@google.com> Subject: [PATCH] KVM: arm64: vgic: Annotate struct vgic_dist with __counted_by_ptr From: Bill Wendling To: linux-kernel@vger.kernel.org Cc: Bill Wendling , Marc Zyngier , Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Gogul Balakrishnan , Arman Hasanzadeh , Kees Cook , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, codemender-patching+linux@google.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add the __counted_by_ptr attribute to the spis pointer field in struct vgic_dist. This pointer field points to an array of struct vgic_irq elements, and the number of elements is tracked by the nr_spis field within the same structure. The nr_spis field is initialized in vgic_init() (or earlier via userspace) before the spis array is allocated in kvm_vgic_dist_init(). The nr_spis value remains constant during the lifetime of the spis allocation, making it a suitable counter for the array. This patch was generated by CodeMender and reviewed by Bill Wendling. Tested with the KVM selftests. Signed-off-by: Bill Wendling Reviewed-by: Kees Cook --- Cc: Marc Zyngier Cc: Oliver Upton Cc: Joey Gouly Cc: Suzuki K Poulose Cc: Zenghui Yu Cc: Gogul Balakrishnan Cc: Arman Hasanzadeh Cc: Kees Cook Cc: linux-arm-kernel@lists.infradead.org Cc: kvmarm@lists.linux.dev Cc: linux-kernel@vger.kernel.org Cc: codemender-patching+linux@google.com --- include/kvm/arm_vgic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index f2eafc65bbf4..1cca87623d92 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h @@ -284,7 +284,7 @@ struct vgic_dist { /* Wants SGIs without active state */ bool nassgireq; =20 - struct vgic_irq *spis; + struct vgic_irq *spis __counted_by_ptr(nr_spis); =20 struct vgic_io_device dist_iodev; struct vgic_io_device cpuif_iodev; --=20 2.53.0.851.ga537e3e6e9-goog