From nobody Mon Feb 9 06:50:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1633099316; cv=none; d=zohomail.com; s=zohoarc; b=gTNdB+DFI6L2rO+YQ6liZc5njKwBTuweuZJO9IVkradDtFEyucMSFFFlsXeKGlav636Lj7VQyTK4hpGxpXNVojk92n4CWXgcXqGzz++mYPscqDJFyL1UNdwZa6Nrbpkky5dYZsKzdFgD0X4TC8dHDybHajR5xpjxT/eZQ9FsbWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633099316; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=iLjVHeuXuy/Volj0MJ8W/LU2eVpEqcrDIkxfe1BgkZk=; b=nRgE9Sp7k81w0V49V+h1PcphEAg5PD+4U2x7BF3GqBeQZvIu0DU6IEuzOzy876ZjEM/Jvr1w8gQpLQvJug6/vbN406E4dQJf0sU2cpIsa4ewGnZqSooGFzhAgNjYYSJvNs9JkLXwrJOPJmeAs3RThygBRsJTPYQbfT5l/1BwZ+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633099316947663.1670165065253; Fri, 1 Oct 2021 07:41:56 -0700 (PDT) Received: from localhost ([::1]:43354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWJjY-0005AK-01 for importer@patchew.org; Fri, 01 Oct 2021 10:41:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWJdw-0005jB-VI for qemu-devel@nongnu.org; Fri, 01 Oct 2021 10:36:08 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:33749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWJdv-0008Ve-Ia for qemu-devel@nongnu.org; Fri, 01 Oct 2021 10:36:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=iLjVHeuXuy/Volj0MJ8W/LU2eVpEqcrDIkxfe1BgkZk=; b=INBqL 4PkJMD5NmUEhchn6V8vXkpmqUhSzlYzGGOcBBcAElz4NzNdJ/FYFWMr8KWu58qntfvIrO9ciwqrzY MBRIJzjYLKGb88McgCIJehxbdFlJvn0N8KnBDObdk76nmM/fr/+3/NRrziuUST3CSM2HnXVM9Zlya M/rwdfQ9We6sa+Hp6L5yQKsLlJfdXm65eMPMbNH4aRnZgSYA57aKuXZFt1zVnxQ5WjW1Xp6MkG3gP 0dvjTz4V/RKGoEk3VnDDaERz+VUg2p6y4HUu60Mv9w23O0Y7OsjwaPpCvGd5KqGUO5FUgmDwHSATw otL1d7MY341xC20ruNx4eVXVYx8YQ==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Fri, 1 Oct 2021 16:27:13 +0200 Subject: [PATCH 2/5] fsdev/p9array.h: check scalar type in P9ARRAY_NEW() To: qemu-devel@nongnu.org Cc: Greg Kurz , Richard Henderson 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=lists.gnu.org; Received-SPF: none client-ip=91.194.90.13; envelope-from=c1965e2a096835dc9e1d4d659dfb15d96755cbe0@lizzy.crudebyte.com; helo=lizzy.crudebyte.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, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1633099318724100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Make sure at compile time that the scalar type of the array requested to be created via P9ARRAY_NEW() matches the scalar type of the passed auto reference variable (unique pointer). Suggested-by: Richard Henderson Signed-off-by: Christian Schoenebeck --- fsdev/p9array.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fsdev/p9array.h b/fsdev/p9array.h index fff946a3d7..6aa25327ca 100644 --- a/fsdev/p9array.h +++ b/fsdev/p9array.h @@ -27,6 +27,8 @@ #ifndef QEMU_P9ARRAY_H #define QEMU_P9ARRAY_H =20 +#include "qemu/compiler.h" + /** * P9Array provides a mechanism to access arrays in common C-style (e.g. by * square bracket [] operator) in conjunction with reference variables that @@ -149,6 +151,10 @@ * @param len - amount of array elements to be allocated immediately */ #define P9ARRAY_NEW(scalar_type, auto_var, len) \ + QEMU_BUILD_BUG_MSG( \ + !__builtin_types_compatible_p(scalar_type, typeof(*auto_var)), \ + "P9Array scalar type mismatch" \ + ); \ p9array_new_##scalar_type((&auto_var), len) =20 #endif /* QEMU_P9ARRAY_H */ --=20 2.20.1