Skip to contentSkip to conversation

scsi: qla4xxx: Remove duplicate struct crb_addr_pair

PATCH Applied Kees Cook 2 participants 3 messages Apr 26, 2025 – May 6, 2025

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 scsi: qla4xxx: Remove duplicate struct crb_addr_pair

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.

---
Cc: Nilesh Javali <[email protected]>
Cc: Manish Rangankar <[email protected]>
Cc: <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: "Martin K. Petersen" <[email protected]>
Cc: <[email protected]>

---
 drivers/scsi/qla4xxx/ql4_nx.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/scsi/qla4xxx/ql4_nx.c +0 -5
index 47adff9f0506..da2fc66ffedd 100644
@@ -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);
 
Signature · 1 line
2.34.1
#1 lore raw

Kees,

Quoted 5 lines

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!

Signature · 1 line
Martin K. Petersen
#2 lore raw
In reply to Kees Cook
Quoted 10 lines · Kees Cook

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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering