* [PATCH] scsi: hisi_sas: Add a missing call to kfree
@ 2016-11-19 17:42 ` Quentin Lambert
0 siblings, 0 replies; 12+ messages in thread
From: Quentin Lambert @ 2016-11-19 17:42 UTC (permalink / raw)
To: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, kernel-janitors
Cc: Quentin Lambert
Most error branches following the call to hisi_sas_shost_alloc contain
a call to kfree. This patch add these calls where they are
missing.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -1503,8 +1503,10 @@ int hisi_sas_probe(struct platform_devic
arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL);
arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL);
- if (!arr_phy || !arr_port)
- return -ENOMEM;
+ if (!arr_phy || !arr_port) {
+ rc = -ENOMEM;
+ goto err_out_ha;
+ }
sha->sas_phy = arr_phy;
sha->sas_port = arr_port;
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] scsi: hisi_sas: Add a missing call to kfree
@ 2016-11-19 17:42 ` Quentin Lambert
0 siblings, 0 replies; 12+ messages in thread
From: Quentin Lambert @ 2016-11-19 17:42 UTC (permalink / raw)
To: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, kernel-janitors
Cc: Quentin Lambert
Most error branches following the call to hisi_sas_shost_alloc contain
a call to kfree. This patch add these calls where they are
missing.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -1503,8 +1503,10 @@ int hisi_sas_probe(struct platform_devic
arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL);
arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL);
- if (!arr_phy || !arr_port)
- return -ENOMEM;
+ if (!arr_phy || !arr_port) {
+ rc = -ENOMEM;
+ goto err_out_ha;
+ }
sha->sas_phy = arr_phy;
sha->sas_port = arr_port;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
2016-11-19 17:42 ` Quentin Lambert
@ 2016-11-21 12:53 ` John Garry
-1 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2016-11-21 12:53 UTC (permalink / raw)
To: Quentin Lambert, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel, kernel-janitors
On 19/11/2016 17:42, Quentin Lambert wrote:
> Most error branches following the call to hisi_sas_shost_alloc contain
> a call to kfree. This patch add these calls where they are
> missing.
>
> This issue was found with Hector.
I think that this patch is fine. However I have noticed that we should
do a call to hisi_sas_free() for this failure, and later failures in the
probe.
I can generate a patch for this.
Cheers,
John
>
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
>
> ---
> drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> --- a/drivers/scsi/hisi_sas/hisi_sas_main.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
> @@ -1503,8 +1503,10 @@ int hisi_sas_probe(struct platform_devic
>
> arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL);
> arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL);
> - if (!arr_phy || !arr_port)
> - return -ENOMEM;
> + if (!arr_phy || !arr_port) {
> + rc = -ENOMEM;
> + goto err_out_ha;
> + }
>
> sha->sas_phy = arr_phy;
> sha->sas_port = arr_port;
>
> .
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
@ 2016-11-21 12:53 ` John Garry
0 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2016-11-21 12:53 UTC (permalink / raw)
To: Quentin Lambert, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel, kernel-janitors
On 19/11/2016 17:42, Quentin Lambert wrote:
> Most error branches following the call to hisi_sas_shost_alloc contain
> a call to kfree. This patch add these calls where they are
> missing.
>
> This issue was found with Hector.
I think that this patch is fine. However I have noticed that we should
do a call to hisi_sas_free() for this failure, and later failures in the
probe.
I can generate a patch for this.
Cheers,
John
>
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
>
> ---
> drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> --- a/drivers/scsi/hisi_sas/hisi_sas_main.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
> @@ -1503,8 +1503,10 @@ int hisi_sas_probe(struct platform_devic
>
> arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL);
> arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL);
> - if (!arr_phy || !arr_port)
> - return -ENOMEM;
> + if (!arr_phy || !arr_port) {
> + rc = -ENOMEM;
> + goto err_out_ha;
> + }
>
> sha->sas_phy = arr_phy;
> sha->sas_port = arr_port;
>
> .
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
2016-11-21 12:53 ` John Garry
@ 2016-11-21 13:20 ` Quentin Lambert
-1 siblings, 0 replies; 12+ messages in thread
From: Quentin Lambert @ 2016-11-21 13:20 UTC (permalink / raw)
To: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, kernel-janitors
On 11/21/2016 01:53 PM, John Garry wrote:
> However I have noticed that we should do a call to hisi_sas_free() for
> this failure, and later failures in the probe.
I don't understand why, and would welcome the opportunity to learn
something.
Quentin
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
@ 2016-11-21 13:20 ` Quentin Lambert
0 siblings, 0 replies; 12+ messages in thread
From: Quentin Lambert @ 2016-11-21 13:20 UTC (permalink / raw)
To: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, kernel-janitors
On 11/21/2016 01:53 PM, John Garry wrote:
> However I have noticed that we should do a call to hisi_sas_free() for
> this failure, and later failures in the probe.
I don't understand why, and would welcome the opportunity to learn
something.
Quentin
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
2016-11-21 13:20 ` Quentin Lambert
@ 2016-11-21 14:16 ` John Garry
-1 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2016-11-21 14:16 UTC (permalink / raw)
To: Quentin Lambert, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel, kernel-janitors
On 21/11/2016 13:20, Quentin Lambert wrote:
>
>
> On 11/21/2016 01:53 PM, John Garry wrote:
>> However I have noticed that we should do a call to hisi_sas_free() for
>> this failure, and later failures in the probe.
> I don't understand why, and would welcome the opportunity to learn
> something.
>
We call hisi_sas_alloc() from hisi_sas_shost_alloc(); if we fail after
this in hisi_sas_probe(), then we should free the memmories and
workqueue got in hisi_sas_alloc(), which we don't.
Thanks,
John
> Quentin
>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
@ 2016-11-21 14:16 ` John Garry
0 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2016-11-21 14:16 UTC (permalink / raw)
To: Quentin Lambert, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel, kernel-janitors
On 21/11/2016 13:20, Quentin Lambert wrote:
>
>
> On 11/21/2016 01:53 PM, John Garry wrote:
>> However I have noticed that we should do a call to hisi_sas_free() for
>> this failure, and later failures in the probe.
> I don't understand why, and would welcome the opportunity to learn
> something.
>
We call hisi_sas_alloc() from hisi_sas_shost_alloc(); if we fail after
this in hisi_sas_probe(), then we should free the memmories and
workqueue got in hisi_sas_alloc(), which we don't.
Thanks,
John
> Quentin
>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
2016-11-21 14:16 ` John Garry
@ 2016-11-21 14:25 ` Quentin Lambert
-1 siblings, 0 replies; 12+ messages in thread
From: Quentin Lambert @ 2016-11-21 14:25 UTC (permalink / raw)
To: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, kernel-janitors
On 11/21/2016 03:16 PM, John Garry wrote:
> On 21/11/2016 13:20, Quentin Lambert wrote:
>>
>>
>> On 11/21/2016 01:53 PM, John Garry wrote:
>>> However I have noticed that we should do a call to hisi_sas_free() for
>>> this failure, and later failures in the probe.
>> I don't understand why, and would welcome the opportunity to learn
>> something.
>>
>
> We call hisi_sas_alloc() from hisi_sas_shost_alloc(); if we fail after
> this in hisi_sas_probe(), then we should free the memmories and
> workqueue got in hisi_sas_alloc(), which we don't.
Thanks.
Are you writing the patch or do you want me to do it?
Quentin
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
@ 2016-11-21 14:25 ` Quentin Lambert
0 siblings, 0 replies; 12+ messages in thread
From: Quentin Lambert @ 2016-11-21 14:25 UTC (permalink / raw)
To: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, kernel-janitors
On 11/21/2016 03:16 PM, John Garry wrote:
> On 21/11/2016 13:20, Quentin Lambert wrote:
>>
>>
>> On 11/21/2016 01:53 PM, John Garry wrote:
>>> However I have noticed that we should do a call to hisi_sas_free() for
>>> this failure, and later failures in the probe.
>> I don't understand why, and would welcome the opportunity to learn
>> something.
>>
>
> We call hisi_sas_alloc() from hisi_sas_shost_alloc(); if we fail after
> this in hisi_sas_probe(), then we should free the memmories and
> workqueue got in hisi_sas_alloc(), which we don't.
Thanks.
Are you writing the patch or do you want me to do it?
Quentin
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
2016-11-21 14:25 ` Quentin Lambert
@ 2016-11-21 14:32 ` John Garry
-1 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2016-11-21 14:32 UTC (permalink / raw)
To: Quentin Lambert, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel, kernel-janitors
On 21/11/2016 14:25, Quentin Lambert wrote:
>
> On 11/21/2016 03:16 PM, John Garry wrote:
>> On 21/11/2016 13:20, Quentin Lambert wrote:
>>>
>>>
>>> On 11/21/2016 01:53 PM, John Garry wrote:
>>>> However I have noticed that we should do a call to hisi_sas_free() for
>>>> this failure, and later failures in the probe.
>>> I don't understand why, and would welcome the opportunity to learn
>>> something.
>>>
>>
>> We call hisi_sas_alloc() from hisi_sas_shost_alloc(); if we fail after
>> this in hisi_sas_probe(), then we should free the memmories and
>> workqueue got in hisi_sas_alloc(), which we don't.
> Thanks.
> Are you writing the patch or do you want me to do it?
>
We can do it, thanks.
> Quentin
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree
@ 2016-11-21 14:32 ` John Garry
0 siblings, 0 replies; 12+ messages in thread
From: John Garry @ 2016-11-21 14:32 UTC (permalink / raw)
To: Quentin Lambert, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel, kernel-janitors
On 21/11/2016 14:25, Quentin Lambert wrote:
>
> On 11/21/2016 03:16 PM, John Garry wrote:
>> On 21/11/2016 13:20, Quentin Lambert wrote:
>>>
>>>
>>> On 11/21/2016 01:53 PM, John Garry wrote:
>>>> However I have noticed that we should do a call to hisi_sas_free() for
>>>> this failure, and later failures in the probe.
>>> I don't understand why, and would welcome the opportunity to learn
>>> something.
>>>
>>
>> We call hisi_sas_alloc() from hisi_sas_shost_alloc(); if we fail after
>> this in hisi_sas_probe(), then we should free the memmories and
>> workqueue got in hisi_sas_alloc(), which we don't.
> Thanks.
> Are you writing the patch or do you want me to do it?
>
We can do it, thanks.
> Quentin
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-11-21 14:33 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-19 17:42 [PATCH] scsi: hisi_sas: Add a missing call to kfree Quentin Lambert
2016-11-19 17:42 ` Quentin Lambert
2016-11-21 12:53 ` John Garry
2016-11-21 12:53 ` John Garry
2016-11-21 13:20 ` Quentin Lambert
2016-11-21 13:20 ` Quentin Lambert
2016-11-21 14:16 ` John Garry
2016-11-21 14:16 ` John Garry
2016-11-21 14:25 ` Quentin Lambert
2016-11-21 14:25 ` Quentin Lambert
2016-11-21 14:32 ` John Garry
2016-11-21 14:32 ` John Garry
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.