From nobody Sun May 24 19:33:08 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 7091F2D1F44 for ; Sat, 23 May 2026 05:03:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779512581; cv=none; b=uWgZANcHp1AuOYDRIJImN73LzPICJ3qis4ZlWGISU3WgT5ao8G2vjMk2h40t5pBlJHloYGB+Yl1enxjphYpR/rDBqP9Q3I2+CpAPeisQO2brJKAKe92naYeIMCXDYyz843zXBCSrTPFSTf8esNOwuM0I0iCntklbiL2a7rPVwAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779512581; c=relaxed/simple; bh=jQJ2qFF074cR89wuFp4c9Jj5HzBzhq4twa0i+QOq2eA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RJNAtuVaY2jdb5NPS0u+gqJw9m9axEBqccA5ryi0n/D0XrzwYLKW9/VFEKNMRsAlL8RNwMVILU52q5HZcpOYj53sXBrFsIXbmTxIF5eaUimLMlpDjuEi/xYP7G45CPDPn+GJDvpXcKr7ernPcoARpAcopNpJmZGuPBHpDmMz2Kw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C4SweenO; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C4SweenO" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-835386ff122so8208601b3a.3 for ; Fri, 22 May 2026 22:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779512579; x=1780117379; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=875rkuTs2QJz3nUSmxbt1umQe94h+dEtfCuWCoCurMk=; b=C4SweenOwwTgOVlCyG1ilxYCduaXjxKapaX9HReIlidj2Q8QZAn5Eqw5yMO6EDsZ2N k5XSrwm0xvha1XX4T0OMrfY75+BdU7Ei1e4/xZ8GgiT6mvGmv9Ad8VUlmTl0e44zOz0a WF206cxlFB2zIr63J5cwnoJat2Ga2szsNlGXuDnGFvt56ldJbBZDKJrW4Ii+N93RkVvQ rVmzCYlerZ1oX59EKYCoOWoiWWL9p3ZOzeJM6aeeqhxiXMpjxuor9ypgl1RxTGHdY+Im 56mkNgM4BT0xRtracDIGI5lTsXm3CwPfnBHL6/XZo74di2raH9vpcmy8e38E6BWtR44J 93iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779512579; x=1780117379; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=875rkuTs2QJz3nUSmxbt1umQe94h+dEtfCuWCoCurMk=; b=UtrEb5Phicg2x0OszZAJTvuFhZh2/NPkXx9Jq3vrGLvqAX1hthaO3Uz6XR+mxZcJsS T1ggTemq7at/dTRuV0kTJ5T9ZsUzuzh9hBnxIPkHA31ngf5hkoqw8glQJkuyHX4ZKjle BrH7Qq36JRJX0GQTCwgZoA69ywQEqMA0wNXQdw6RjCL353azlkf1hhnnBUPdc/inciPJ bfDy0lVdlqS2llMsZHAUrS578rGPpYsbA6oKEFkXJMvEW6MWw3kW8J3OGswYLOLKTzqJ z/ZCFfokh0XwFWHNAGos82e1j1+TtW2ti0HDdUNO+LXxRTBv26BF7asi30nd8bpFqCGK uJkQ== X-Forwarded-Encrypted: i=1; AFNElJ/Zh+QcjCRNPfhx4rGQGeG/k3gzi1Z/Jw+PzjekarR5vQmUyii6WCZqh8crJ0U6t8813JXE0+Jy52Vyn64=@vger.kernel.org X-Gm-Message-State: AOJu0YxnTtx90B+bReCTxOnTleX9zObUjoO7+UItDh+yuiXWKKMSxMEQ W7gvuJCdXAL0d8+4IzxAuwEbvnztWxZkr9MlgeqQePMx5BgL22FefMbC7fqE7rF7 X-Gm-Gg: Acq92OHrgZ/76Rw6IoS6Ny9d1FvV0yvQErjqBjR0PMsXhQRYemQITxOSoXD5Z5LsrMl gh0JvqQUig0tZC0x3GvFMLyxkJLtQCal85j/EEqbOZf1F1JMSHUU/V2EwaHmzL5Vwk/3PTLwZU/ JTYsDxXOV4NkEAQBy7BjsH8zQn8Z2ummn/Q7wvOF+AMJ7UgA8fnTXLiOzMn2++YbYQLm5JjyCAP 8ioyC+CtF9Le434ca5f5Vgxd8xB2jx+CwPY2LoNdfFZ41yPtiHEJCgmDMsAJVwjMYyjxzpWqwn2 jyApjXOX7YGp+alYiPU9TOaw6Ojl+R41wFCnXtvcqy9OxM6HM0U23owXgSG3RZ7yQEpsbpvt+yQ uAX9q7H0q2OHoycH8az+UkCatAnze7kry7AR6Us75CGu1F/h3advPG4zi+2qBbXoQ3J9OzPXyvM SKi6ZL1LRGQureS+C2CU9HZ/0OHZo8tO/hy+4s1NCrPE8veBa7Na4kdEkGxk0u7PcjmndEP2wG8 Knve2sKxMrN9dD2kfC2K+XH+IFe/1p1MuSB6a6u2fGvEcrS4KO9Z4Al X-Received: by 2002:a05:6a00:8c04:b0:82f:4f63:31e1 with SMTP id d2e1a72fcca58-8415f3af3e3mr7144628b3a.8.1779512579512; Fri, 22 May 2026 22:02:59 -0700 (PDT) Received: from ryzen ([2601:644:8000:5b5d:7285:c2ff:fe45:8a32]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84164fe0bb8sm3184236b3a.51.2026.05.22.22.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 22:02:58 -0700 (PDT) From: Rosen Penev To: linux-scsi@vger.kernel.org Cc: Justin Tee , Paul Ely , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] scsi: lpfc: turn lpfc_queue q_pgs into a flexible array Date: Fri, 22 May 2026 22:02:41 -0700 Message-ID: <20260523050241.190239-1-rosenp@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The q_pgs pointer was assigned to point at the trailing memory allocated past the struct. Convert it to a proper C99 flexible array member and use struct_size() for the allocation. Assisted-by: Claude:Opus-4.7 Signed-off-by: Rosen Penev --- drivers/scsi/lpfc/lpfc_sli.c | 3 +-- drivers/scsi/lpfc/lpfc_sli4.h | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index d38fb374b379..0e56e7034566 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -15875,7 +15875,7 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32= _t page_size, if (pgcnt > phba->sli4_hba.pc_sli4_params.wqpcnt) pgcnt =3D phba->sli4_hba.pc_sli4_params.wqpcnt; =20 - queue =3D kzalloc_node(sizeof(*queue) + (sizeof(void *) * pgcnt), + queue =3D kzalloc_node(struct_size(queue, q_pgs, pgcnt), GFP_KERNEL, cpu_to_node(cpu)); if (!queue) return NULL; @@ -15892,7 +15892,6 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32= _t page_size, * resources, the free routine needs to know what was allocated. */ queue->page_count =3D pgcnt; - queue->q_pgs =3D (void **)&queue[1]; queue->entry_cnt_per_pg =3D hw_page_size / entry_size; queue->entry_size =3D entry_size; queue->entry_count =3D entry_count; diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 2744786d9c94..e2b95fb50d55 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h @@ -280,9 +280,10 @@ struct lpfc_queue { uint64_t isr_timestamp; struct lpfc_queue *assoc_qp; struct list_head _poll_list; - void **q_pgs; /* array to index entries per page */ =20 enum lpfc_poll_mode poll_mode; + + void *q_pgs[]; /* array to index entries per page */ }; =20 struct lpfc_sli4_link { --=20 2.54.0