* [PATCH] scsi: sym53c8xx_2: fix sizeof mismatch
@ 2020-10-06 11:02 Colin King
2020-10-08 3:12 ` Martin K. Petersen
2020-10-13 22:42 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2020-10-06 11:02 UTC (permalink / raw)
To: Matthew Wilcox, James E . J . Bottomley, Martin K . Petersen, linux-scsi
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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)")
Fixes: 473c67f96e06 ("[PATCH] sym2 version 2.2.0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/scsi/sym53c8xx_2/sym_hipd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index cc11daa1222b..14118dd70711 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -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;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: sym53c8xx_2: fix sizeof mismatch
2020-10-06 11:02 [PATCH] scsi: sym53c8xx_2: fix sizeof mismatch Colin King
@ 2020-10-08 3:12 ` Martin K. Petersen
2020-10-13 22:42 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2020-10-08 3:12 UTC (permalink / raw)
To: Colin King
Cc: Matthew Wilcox, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, kernel-janitors, linux-kernel
Colin,
> 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.
Applied to 5.10/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: sym53c8xx_2: fix sizeof mismatch
2020-10-06 11:02 [PATCH] scsi: sym53c8xx_2: fix sizeof mismatch Colin King
2020-10-08 3:12 ` Martin K. Petersen
@ 2020-10-13 22:42 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2020-10-13 22:42 UTC (permalink / raw)
To: James E . J . Bottomley, Matthew Wilcox, Colin King, linux-scsi
Cc: Martin K . Petersen, linux-kernel, kernel-janitors
On Tue, 6 Oct 2020 12:02:52 +0100, Colin King wrote:
> 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 ]
Applied to 5.10/scsi-queue, thanks!
[1/1] scsi: sym53c8xx_2: Fix sizeof() mismatch
https://git.kernel.org/mkp/scsi/c/1725ba8d6ff1
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-13 22:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 11:02 [PATCH] scsi: sym53c8xx_2: fix sizeof mismatch Colin King
2020-10-08 3:12 ` Martin K. Petersen
2020-10-13 22:42 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).