scsi: sym53c8xx_2: fix sizeof mismatch
PATCH 1/1 scsi: sym53c8xx_2: fix sizeof mismatch
From: Colin Ian King <[email protected]>
An incorrect sizeof is being used, struct sym_ccb ** is not correct, it should be struct sym_ccb *. Note that since ** is the same size as
* this is not causing any issues. Improve this fix by using the idiom sizeof(*np->ccbh) as this allows one to not even reference the type of the pointer.
[ Note: this is an ancient 2005 buglet, the sha is from the
tglx/history repo ]
Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)")
--- drivers/scsi/sym53c8xx_2/sym_hipd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sym53c8xx_2/sym_hipd.c +1 -1
@@ -5656,7 +5656,7 @@ int sym_hcb_attach(struct Scsi_Host *shost, struct sym_fw *fw, struct sym_nvram/* * Allocate the array of lists of CCBs hashed by DSA. */ - np->ccbh =kcalloc (CCB_HASH_SIZE ,sizeof (struct sym_ccb **),GFP_KERNEL ); + np->ccbh =kcalloc (CCB_HASH_SIZE ,sizeof (*np->ccbh),GFP_KERNEL );if (!np->ccbh) goto attach_failed;
Signature · 1 line
2.27.0
Martin K. Petersen
AppliedColin,
Quoted 5 lines
An incorrect sizeof is being used, struct
sym_ccb** is not correct, it should be structsym_ccb*. Note that since ** is the same size as
* this is not causing any issues. Improve this fix by using the idiomsizeof(*np->ccbh)as this allows one to not even reference the type of the pointer.
Applied to 5.10/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · Colin King
An incorrect sizeof is being used, struct
sym_ccb** is not correct, it should be structsym_ccb*. Note that since ** is the same size as
* this is not causing any issues. Improve this fix by using the idiomsizeof(*np->ccbh)as this allows one to not even reference the type of the pointer.[ Note: this is an ancient 2005 buglet, the sha is from the
tglx/history repo ]
Applied to 5.10/scsi-queue, thanks!
[1/1] scsi: sym53c8xx_2: Fix sizeof() mismatch
https://git.kernel.org/mkp/scsi/c/1725ba8d6ff1
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering