Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1526098 > unrolled thread
| Started by | Quentin Lambert <lambert.quentin@gmail.com> |
|---|---|
| First post | 2016-11-19 18:50 +0100 |
| Last post | 2016-11-21 15:40 +0100 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] scsi: hisi_sas: Add a missing call to kfree Quentin Lambert <lambert.quentin@gmail.com> - 2016-11-19 18:50 +0100
Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree John Garry <john.garry@huawei.com> - 2016-11-21 14:00 +0100
Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree Quentin Lambert <lambert.quentin@gmail.com> - 2016-11-21 14:30 +0100
Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree John Garry <john.garry@huawei.com> - 2016-11-21 15:20 +0100
Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree Quentin Lambert <lambert.quentin@gmail.com> - 2016-11-21 15:30 +0100
Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree John Garry <john.garry@huawei.com> - 2016-11-21 15:40 +0100
| From | Quentin Lambert <lambert.quentin@gmail.com> |
|---|---|
| Date | 2016-11-19 18:50 +0100 |
| Subject | [PATCH] scsi: hisi_sas: Add a missing call to kfree |
| Message-ID | <sFhW1-7Z6-23@gated-at.bofh.it> |
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;
[toc] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-11-21 14:00 +0100 |
| Message-ID | <sFWmy-1in-11@gated-at.bofh.it> |
| In reply to | #1526098 |
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;
>
> .
>
[toc] | [prev] | [next] | [standalone]
| From | Quentin Lambert <lambert.quentin@gmail.com> |
|---|---|
| Date | 2016-11-21 14:30 +0100 |
| Message-ID | <sFWPv-1GV-19@gated-at.bofh.it> |
| In reply to | #1526648 |
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
[toc] | [prev] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-11-21 15:20 +0100 |
| Message-ID | <sFXBT-2h6-7@gated-at.bofh.it> |
| In reply to | #1526672 |
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 > > >
[toc] | [prev] | [next] | [standalone]
| From | Quentin Lambert <lambert.quentin@gmail.com> |
|---|---|
| Date | 2016-11-21 15:30 +0100 |
| Message-ID | <sFXLz-2km-3@gated-at.bofh.it> |
| In reply to | #1526698 |
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
[toc] | [prev] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-11-21 15:40 +0100 |
| Message-ID | <sFXVf-2nj-17@gated-at.bofh.it> |
| In reply to | #1526713 |
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 > >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web