Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1836745lqo; Sun, 19 May 2024 00:37:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQImZWJFWvjWWiWtIhcY17xgOByMLbLBcCd1UDY5OcdxKHHpiJFjNl4df7sqNRTdCRimtsfjooGm4e8wBy+ttrFoM639mvRNfMAmbkxA== X-Google-Smtp-Source: AGHT+IEydLFKxdU/Kuk8dpQjNCEArPNlqIsLHiOGx5uNFbCRWXEAUFEWOmETBvTJXZ/XGrpktFKw X-Received: by 2002:a17:90a:db89:b0:2b6:208c:2aee with SMTP id 98e67ed59e1d1-2bd6040a557mr4583966a91.20.1716104226420; Sun, 19 May 2024 00:37:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716104226; cv=pass; d=google.com; s=arc-20160816; b=HBC0tJQ2gR3l79DdHi2zvt1Tm1fsA1nk+Uf/homjW9wk1EIaVqbNKv37OYk0iGK9Rv H1/8migTBXwfrnuN8tLn+egaDVzukm9XAwhjBracKwlt+rkKyMDOlSL5D1Gnmk1YxIxY Z5JbmcHM/uNYL0pIKDN3xZgpUPyGjgW4SFeM3WzyYvfwC7CoordQJSwm9gy7K4QwOrnD IORM7igGpJrl8zxJc1yAjfu5IbOX4ysz43GSOJnLCJNcAC5zCULlFJAUH6FOsls4fJxJ NmMoGUSVMAZsezgzW79lgwBp27Gt/Q0ipkfqm4gPzBkVo9YjRVDAw/9uYw2+OoLhLVwV gi7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=DpV324OF1N6KWvT4lJQi/tT98cIN5IcDh30eoiZYvd0=; fh=B7J8aRZYosML83cYsADlwpaztuaIsk3qOkV0D3y1Sg8=; b=xMS5Wm4bKmdxj1JbtcclnUASjSnHLV9k3fza6c8wOUPGR4GUvC9zMcmDIDWP3gDvjP Gi/vgnJKk02ZEWLCUv5i6rO6uwjNjmUWFJykKxElDhsjFKjk7oSOPFCxivI3A2C6H1Eg YmtrlnzApjVILljgLoOJ5klJnSAciljgFiUCkh2d1B6ip7DmaMrjuP6tfjvEnz0UDrEt rVQVm6cQIgE/chTWcpr7Fyd8sjfAI8OVzgubJuYq/69wqPaOh5PwuPlA6BBDNVrMi85f 18RpX0qp0Y0v7J+iXf6lO0VJJqPuWUdxGfzO20z09UZk8ihfmEdE64Q9IHqXWMtVPrAa XcLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=laMt+PtV; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-183039-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183039-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bd68556099si1818284a91.0.2024.05.19.00.37.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 00:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183039-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=laMt+PtV; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-183039-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183039-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4379FB20EE7 for ; Sun, 19 May 2024 07:36:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B88841805A; Sun, 19 May 2024 07:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="laMt+PtV" Received: from msa.smtpout.orange.fr (smtp-70.smtpout.orange.fr [80.12.242.70]) (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 08BE115AC4; Sun, 19 May 2024 07:36:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716104205; cv=none; b=S5n34EAQKauEE+SZzw4Uz8nkvRm+1SZbl3EYD0pJ1EfdpNZHkm++rqht0rehL3U1oSb5wgPqo8iQM4Ftq2lM+4ZdAocqpUT5NsIGr6rixwaQJBCezmDKTIKfaHpwKkL9zN5V204abDBXGwxPIh+Kf0lrFw29q71t+Mdi7EWAxf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716104205; c=relaxed/simple; bh=EvmQQWNeJGwNqewjsCWVicRfAYaNcgdeLiLjrEetQbE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AVMpLh2CoHaHPITJbPvaiPGAXKa+no//qK2VzxnEc6azHCAEKVbjRhA+keS4j5fpg/U5fYjG5bkuRU9lk4pLSRz84uyrM1OlY8Nl6fP5GtPLswXF9uE5aKulaqipPJCqep9/NoyhWkNEuEnh4PpXeYuGtxZ9ArSVCzHLPO8KVS4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=laMt+PtV; arc=none smtp.client-ip=80.12.242.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from localhost.localdomain ([86.243.17.157]) by smtp.orange.fr with ESMTPA id 8aYusLlTw69OH8aYusyjjq; Sun, 19 May 2024 09:02:30 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1716102150; bh=DpV324OF1N6KWvT4lJQi/tT98cIN5IcDh30eoiZYvd0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=laMt+PtVCBzsbS0whtoPwaW+J+XwtrmW2Nl3RA2gKV94y/I0bEpUVtDm2QEr1x6X4 3bNbLg8hPALHUdhBB+piZyiuMXEGjPbTIaS9/SryDTbieWwtwfwpbDrwvnItMnwwgI i403EWtgKbooMY70cFtTvgzzYh7GcQmSYX4jBx8KXcZMPMI/432UEj9TMWjKB/l0d0 CHr0DwCpGvIgOiVmWsopRcLDYeKIfVmlbbbiLLW8+xOJvghTLOkn9k3k1z1RuzbRbG NcCsZO0vZ9MZH21WeAiY3pLlQTWrvoKj//5A2BPfQe7EmLWp+OHEamjbGcsY2/730G csRzU7MOETESg== X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 19 May 2024 09:02:30 +0200 X-ME-IP: 86.243.17.157 From: Christophe JAILLET To: Mustafa Ismail , Shiraz Saleem , Jason Gunthorpe , Leon Romanovsky , Kees Cook , "Gustavo A. R. Silva" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-rdma@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] RDMA/irdma: Annotate flexible array with __counted_by() in struct irdma_qvlist_info Date: Sun, 19 May 2024 09:02:15 +0200 Message-ID: <2ca8b14adf79c4795d7aa95bbfc79253a6bfed82.1716102112.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 'num_vectors' is used to count the number of elements in the 'qv_info' flexible array in "struct irdma_qvlist_info". So annotate it with __counted_by() to make it explicit and enable some additional checks. This allocation is done in irdma_save_msix_info(). Signed-off-by: Christophe JAILLET --- drivers/infiniband/hw/irdma/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/irdma/main.h b/drivers/infiniband/hw/irdma/main.h index b65bc2ea542f..9f0ed6e84471 100644 --- a/drivers/infiniband/hw/irdma/main.h +++ b/drivers/infiniband/hw/irdma/main.h @@ -239,7 +239,7 @@ struct irdma_qv_info { struct irdma_qvlist_info { u32 num_vectors; - struct irdma_qv_info qv_info[]; + struct irdma_qv_info qv_info[] __counted_by(num_vectors); }; struct irdma_gen_ops { -- 2.45.1