[PATCH] scsi: qla4xxx: Remove duplicate struct crb_addr_pair

Kees Cook posted 1 patch 9 months, 2 weeks ago
drivers/scsi/qla4xxx/ql4_nx.c | 5 -----
1 file changed, 5 deletions(-)
[PATCH] scsi: qla4xxx: Remove duplicate struct crb_addr_pair
Posted by Kees Cook 9 months, 2 weeks ago
In preparation for making the kmalloc family of allocators type aware,
we need to make sure that the returned type from the allocation matches
the type of the variable being assigned. (Before, the allocator would
always return "void *", which can be implicitly cast to any pointer type.)

The assigned type is "struct crb_addr_pair *" and the returned type will
be a _different_ "struct crb_addr_pair *", causing a warning. This really
stumped me for a bit. :) Drop the redundant declaration.

Signed-off-by: Kees Cook <kees@kernel.org>
---
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>
---
 drivers/scsi/qla4xxx/ql4_nx.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 47adff9f0506..da2fc66ffedd 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -973,11 +973,6 @@ qla4_82xx_pinit_from_rom(struct scsi_qla_host *ha, int verbose)
 	unsigned long off;
 	unsigned offset, n;
 
-	struct crb_addr_pair {
-		long addr;
-		long data;
-	};
-
 	/* Halt all the indiviual PEGs and other blocks of the ISP */
 	qla4_82xx_rom_lock(ha);
 
-- 
2.34.1
Re: [PATCH] scsi: qla4xxx: Remove duplicate struct crb_addr_pair
Posted by Martin K. Petersen 9 months, 1 week ago
On Fri, 25 Apr 2025 23:20:11 -0700, Kees Cook wrote:

> In preparation for making the kmalloc family of allocators type aware,
> we need to make sure that the returned type from the allocation matches
> the type of the variable being assigned. (Before, the allocator would
> always return "void *", which can be implicitly cast to any pointer type.)
> 
> The assigned type is "struct crb_addr_pair *" and the returned type will
> be a _different_ "struct crb_addr_pair *", causing a warning. This really
> stumped me for a bit. :) Drop the redundant declaration.
> 
> [...]

Applied to 6.16/scsi-queue, thanks!

[1/1] scsi: qla4xxx: Remove duplicate struct crb_addr_pair
      https://git.kernel.org/mkp/scsi/c/3d030e2feb8a

-- 
Martin K. Petersen	Oracle Linux Engineering
Re: [PATCH] scsi: qla4xxx: Remove duplicate struct crb_addr_pair
Posted by Martin K. Petersen 9 months, 2 weeks ago
Kees,

> In preparation for making the kmalloc family of allocators type aware,
> we need to make sure that the returned type from the allocation
> matches the type of the variable being assigned. (Before, the
> allocator would always return "void *", which can be implicitly cast
> to any pointer type.)

Applied to 6.16/scsi-staging, thanks!

-- 
Martin K. Petersen