From patchwork Wed Oct 2 09:44:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1991911 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJVKW5X9fz1xtq for ; Wed, 2 Oct 2024 19:45:19 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1svvux-0006O9-M5; Wed, 02 Oct 2024 09:45:11 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1svvuu-0006Mq-BP for kernel-team@lists.ubuntu.com; Wed, 02 Oct 2024 09:45:08 +0000 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 2D1283F5BB for ; Wed, 2 Oct 2024 09:45:06 +0000 (UTC) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cb6ed7f9dso64702515e9.3 for ; Wed, 02 Oct 2024 02:45:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727862305; x=1728467105; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oENwllglVRmIv0e3r9Mm6XZDV1WkPyZxR8YCeCvRtF0=; b=XbLXuifwXwWhjmidTYy+7EummsXfXaLh5VN9V1czDTxGtk9BphwLRJG4sGRPMu7drQ M8RfyX4iKeeEgYVexfrbGmFNnL1ircPj8WUcN9FUSkbDhtntdWqUFQ62Bh6tW3xzhwZb YgYN9270xDNlPcFqm+fyCNq9113TM+4j039mYnA8OxqfOg8BrG9tjaoDTTdPyGxDAYlh rlPrNJhmGYJmm7rQzlGnWm+JX3M2A9HBsZTJWjyBgJ1XpZDP//VveW+yZGMFZOR5wGzf WHk2jOrgCtuPrUiaRNJPjKfconhKNIitpd5tnQJri9CcOxcVCpwabdbrAScx5ub+x/Oo U+5w== X-Gm-Message-State: AOJu0Yw5xPKfPwrfaYPSTM1s/i63Qbjr4r4VlKvDIOwwUlXtm8uKCt3A rXVfUyUddMFGe/bezxZncLRQ9NkV4EsfSJrfwAzQTvqorEHdbnAjNsdQE+eoHZPh0DyxEHMTKme v3z1z8vFjTnSNs76f8qxMBI3RiLeC89Ln/VQTyJ1DDZQlyNN7BROb8nRBXzQCtc8zoRfSqgU2Ql rQtA8OQshbig== X-Received: by 2002:a05:600c:511d:b0:426:5e1c:1ac2 with SMTP id 5b1f17b1804b1-42f777b96e7mr24250845e9.8.1727862305040; Wed, 02 Oct 2024 02:45:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMsgR6PH1g5IiO7D4dGZwqTo3oJAbZQs3tnrg/PKRkvLSIq39wqpg26xrEQEEGkFA0UdIP7Q== X-Received: by 2002:a05:600c:511d:b0:426:5e1c:1ac2 with SMTP id 5b1f17b1804b1-42f777b96e7mr24250635e9.8.1727862304636; Wed, 02 Oct 2024 02:45:04 -0700 (PDT) Received: from localhost ([81.221.247.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f79ece88csm13819775e9.21.2024.10.02.02.45.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 02:45:04 -0700 (PDT) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 3/6] scsi: aacraid: union aac_init: Replace 1-element array with flexible array Date: Wed, 2 Oct 2024 11:44:54 +0200 Message-ID: <20241002094457.1777904-4-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002094457.1777904-1-juerg.haefliger@canonical.com> References: <20241002094457.1777904-1-juerg.haefliger@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Kees Cook BugLink: https://bugs.launchpad.net/bugs/2078038 Replace the deprecated[1] use of a 1-element array in union aac_init with a modern flexible array. Additionally add __counted_by annotation since rrq is only ever accessed after rr_queue_count has been set (with the same value used to control the loop): init->r8.rr_queue_count = cpu_to_le32(dev->max_msix); ... for (i = 0; i < dev->max_msix; i++) { addr = (u64)dev->host_rrq_pa + dev->vector_cap * i * sizeof(u32); init->r8.rrq[i].host_addr_high = cpu_to_le32( upper_32_bits(addr)); No binary differences are present after this conversion. Link: https://github.com/KSPP/linux/issues/79 [1] Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20240711174815.work.689-kees@kernel.org Reviewed-by: Gustavo A. R. Silva Signed-off-by: Martin K. Petersen (cherry picked from commit 575b9be63684600e7e02517f0b647e5cb759120c) Signed-off-by: Juerg Haefliger --- drivers/scsi/aacraid/aacraid.h | 2 +- drivers/scsi/aacraid/src.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 7d5a155073c6..659e393c1033 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -873,7 +873,7 @@ union aac_init __le16 element_count; __le16 comp_thresh; __le16 unused; - } rrq[1]; /* up to 64 RRQ addresses */ + } rrq[] __counted_by_le(rr_queue_count); /* up to 64 RRQ addresses */ } r8; }; diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 11ef58204e96..28115ed637e8 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c @@ -410,7 +410,7 @@ static void aac_src_start_adapter(struct aac_dev *dev) lower_32_bits(dev->init_pa), upper_32_bits(dev->init_pa), sizeof(struct _r8) + - (AAC_MAX_HRRQ - 1) * sizeof(struct _rrq), + AAC_MAX_HRRQ * sizeof(struct _rrq), 0, 0, 0, NULL, NULL, NULL, NULL, NULL); } else { init->r7.host_elapsed_seconds =