* [PATCH v2] scsi: aic94xx: Add a missing call to kfree
@ 2016-11-25 12:23 Quentin Lambert
2016-11-28 13:48 ` Tomas Henzl
2016-11-29 16:14 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Quentin Lambert @ 2016-11-25 12:23 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, kernel-janitors, thenzl
Cc: Quentin Lambert
Most error branches following the call to kzalloc contain
a call to kfree. This patch add these calls where they are
missing and set the relevant pointers to NULL.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
v2: set the point to NULL after having freed it
drivers/scsi/aic94xx/aic94xx_hwi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -228,8 +228,11 @@ static int asd_init_scbs(struct asd_ha_s
bitmap_bytes = (asd_ha->seq.tc_index_bitmap_bits+7)/8;
bitmap_bytes = BITS_TO_LONGS(bitmap_bytes*8)*sizeof(unsigned long);
asd_ha->seq.tc_index_bitmap = kzalloc(bitmap_bytes, GFP_KERNEL);
- if (!asd_ha->seq.tc_index_bitmap)
+ if (!asd_ha->seq.tc_index_bitmap) {
+ kfree(asd_ha->seq.tc_index_array);
+ asd_ha->seq.tc_index_array = NULL;
return -ENOMEM;
+ }
spin_lock_init(&seq->tc_index_lock);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scsi: aic94xx: Add a missing call to kfree
2016-11-25 12:23 [PATCH v2] scsi: aic94xx: Add a missing call to kfree Quentin Lambert
@ 2016-11-28 13:48 ` Tomas Henzl
2016-11-29 16:14 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Tomas Henzl @ 2016-11-28 13:48 UTC (permalink / raw)
To: 20161119174038.20083-1-lambert.quentin, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, linux-kernel, kernel-janitors
Cc: Quentin Lambert
On 25.11.2016 13:23, Quentin Lambert wrote:
> Most error branches following the call to kzalloc contain
> a call to kfree. This patch add these calls where they are
> missing and set the relevant pointers to NULL.
>
> This issue was found with Hector.
>
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Looks good,
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Tomas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scsi: aic94xx: Add a missing call to kfree
2016-11-25 12:23 [PATCH v2] scsi: aic94xx: Add a missing call to kfree Quentin Lambert
2016-11-28 13:48 ` Tomas Henzl
@ 2016-11-29 16:14 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2016-11-29 16:14 UTC (permalink / raw)
To: Quentin Lambert
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, kernel-janitors, thenzl,
20161119174038.20083-1-lambert.quentin
>>>>> "Quentin" == Quentin Lambert <lambert.quentin@gmail.com> writes:
Quentin> Most error branches following the call to kzalloc contain a
Quentin> call to kfree. This patch add these calls where they are
Quentin> missing and set the relevant pointers to NULL.
Applied to 4.10/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-29 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 12:23 [PATCH v2] scsi: aic94xx: Add a missing call to kfree Quentin Lambert
2016-11-28 13:48 ` Tomas Henzl
2016-11-29 16:14 ` 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).