* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2019-12-21 3:52 ` wuxu.wu
0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2019-12-21 3:52 UTC (permalink / raw)
To: airlied, daniel, dri-devel, bskeggs
Cc: hushiyuan, nouveau, linux-kernel, wuxu.wu
priv porinter could be free only when priv != null and priv->rom is null.
Signed-off-by: wuxu.wu <wuxu.wu@huawei.com>
---
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
(priv->rom = pci_map_rom(pdev, &priv->size))) {
priv->pdev = pdev;
return priv;
+ } else {
+ kfree(priv);
}
- kfree(priv);
}
pci_disable_rom(pdev);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2019-12-21 3:52 ` wuxu.wu
0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2019-12-21 3:52 UTC (permalink / raw)
To: airlied, daniel, dri-devel, bskeggs
Cc: hushiyuan, nouveau, linux-kernel, wuxu.wu
priv porinter could be free only when priv != null and priv->rom is null.
Signed-off-by: wuxu.wu <wuxu.wu@huawei.com>
---
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
(priv->rom = pci_map_rom(pdev, &priv->size))) {
priv->pdev = pdev;
return priv;
+ } else {
+ kfree(priv);
}
- kfree(priv);
}
pci_disable_rom(pdev);
}
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
[not found] ` <fd3273d3-5814-be43-dbec-e49bc7990705-NQbd8FSOZ1kdnm+yROfE0A@public.gmane.org>
@ 2020-01-03 13:25 ` Wuxu (Max)
0 siblings, 0 replies; 9+ messages in thread
From: Wuxu (Max) @ 2020-01-03 13:25 UTC (permalink / raw)
To: Roy Spliet, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Thank you, I got it
On 2020/1/3 19:58, Roy Spliet wrote:
> (re-sending as plain text)
>
> NACK. The before and after of this patch are functionally identical. The if-block returns unconditionally ("return priv;"), so the kfree will only ever be reached if the condition in the if-statement evaluates to false. Explicitly writing out an else-block is thus superfluous.
>
> Op 03-01-2020 om 09:10 schreef wuxu.wu:
>> Hi, I think there has a incorrect kfree in pcirom_init function. In
>> pcirom_init function priv porinter could be free only when priv != null
>> and priv->rom is null.
>>
>> Signed-off-by: wuxu.wu <wuxu.wu@huawei.com>
>> ---
>> drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
>> index 9b91da0..d776e01 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
>> @@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
>> (priv->rom = pci_map_rom(pdev, &priv->size))) {
>> priv->pdev = pdev;
>> return priv;
>> + } else {
>> + kfree(priv);
>> }
>> - kfree(priv);
>> }
>> pci_disable_rom(pdev);
>> }
>>
>
> .
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
[not found] ` <1578039033-6458-1-git-send-email-wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-01-03 11:53 ` Roy Spliet
@ 2020-01-03 11:58 ` Roy Spliet
[not found] ` <fd3273d3-5814-be43-dbec-e49bc7990705-NQbd8FSOZ1kdnm+yROfE0A@public.gmane.org>
1 sibling, 1 reply; 9+ messages in thread
From: Roy Spliet @ 2020-01-03 11:58 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, wuxu.wu
(re-sending as plain text)
NACK. The before and after of this patch are functionally identical. The
if-block returns unconditionally ("return priv;"), so the kfree will
only ever be reached if the condition in the if-statement evaluates to
false. Explicitly writing out an else-block is thus superfluous.
Op 03-01-2020 om 09:10 schreef wuxu.wu:
> Hi, I think there has a incorrect kfree in pcirom_init function. In
> pcirom_init function priv porinter could be free only when priv != null
> and priv->rom is null.
>
> Signed-off-by: wuxu.wu <wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
> index 9b91da0..d776e01 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
> @@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
> (priv->rom = pci_map_rom(pdev, &priv->size))) {
> priv->pdev = pdev;
> return priv;
> + } else {
> + kfree(priv);
> }
> - kfree(priv);
> }
> pci_disable_rom(pdev);
> }
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
[not found] ` <1578039033-6458-1-git-send-email-wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2020-01-03 11:53 ` Roy Spliet
2020-01-03 11:58 ` Roy Spliet
1 sibling, 0 replies; 9+ messages in thread
From: Roy Spliet @ 2020-01-03 11:53 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
[-- Attachment #1.1: Type: text/plain, Size: 1260 bytes --]
NACK. The before and after of this patch are functionally identical. The
if-block returns unconditionally ("return priv;"), so the kfree will
only ever be reached if the condition in the if-statement evaluates to
false. Explicitly writing out an else-block is thus superfluous.
Op 03-01-2020 om 09:10 schreef wuxu.wu:
> Hi, I think there has a incorrect kfree in pcirom_init function. In
> pcirom_init function priv porinter could be free only when priv != null
> and priv->rom is null.
>
> Signed-off-by: wuxu.wu <wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
> index 9b91da0..d776e01 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
> @@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
> (priv->rom = pci_map_rom(pdev, &priv->size))) {
> priv->pdev = pdev;
> return priv;
> + } else {
> + kfree(priv);
> }
> - kfree(priv);
> }
> pci_disable_rom(pdev);
> }
[-- Attachment #1.2: Type: text/html, Size: 1763 bytes --]
[-- Attachment #2: Type: text/plain, Size: 182 bytes --]
_______________________________________________
Nouveau mailing list
Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2020-01-03 8:10 ` wuxu.wu
0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2020-01-03 8:10 UTC (permalink / raw)
To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA, airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk
Cc: hushiyuan-hv44wF8Li93QT0dZR+AlfA,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
wuxu.wu-hv44wF8Li93QT0dZR+AlfA
Hi, I think there has a incorrect kfree in pcirom_init function. In
pcirom_init function priv porinter could be free only when priv != null
and priv->rom is null.
Signed-off-by: wuxu.wu <wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
(priv->rom = pci_map_rom(pdev, &priv->size))) {
priv->pdev = pdev;
return priv;
+ } else {
+ kfree(priv);
}
- kfree(priv);
}
pci_disable_rom(pdev);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2020-01-03 8:10 ` wuxu.wu
0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2020-01-03 8:10 UTC (permalink / raw)
To: bskeggs, airlied, daniel
Cc: hushiyuan, nouveau, linux-kernel, dri-devel, wuxu.wu
Hi, I think there has a incorrect kfree in pcirom_init function. In
pcirom_init function priv porinter could be free only when priv != null
and priv->rom is null.
Signed-off-by: wuxu.wu <wuxu.wu@huawei.com>
---
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
(priv->rom = pci_map_rom(pdev, &priv->size))) {
priv->pdev = pdev;
return priv;
+ } else {
+ kfree(priv);
}
- kfree(priv);
}
pci_disable_rom(pdev);
}
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2019-12-20 14:05 ` wuxu.wu
0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2019-12-20 14:05 UTC (permalink / raw)
To: airlied, daniel, dri-devel, bskeggs
Cc: hushiyuan, nouveau, linux-kernel, wuxu.wu
priv porinter could be free only when priv != null and priv->rom is null.
---
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
(priv->rom = pci_map_rom(pdev, &priv->size))) {
priv->pdev = pdev;
return priv;
+ } else {
+ kfree(priv);
}
- kfree(priv);
}
pci_disable_rom(pdev);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2019-12-20 14:05 ` wuxu.wu
0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2019-12-20 14:05 UTC (permalink / raw)
To: airlied, daniel, dri-devel, bskeggs
Cc: hushiyuan, nouveau, linux-kernel, wuxu.wu
priv porinter could be free only when priv != null and priv->rom is null.
---
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
(priv->rom = pci_map_rom(pdev, &priv->size))) {
priv->pdev = pdev;
return priv;
+ } else {
+ kfree(priv);
}
- kfree(priv);
}
pci_disable_rom(pdev);
}
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-01-04 11:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-21 3:52 [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init wuxu.wu
2019-12-21 3:52 ` wuxu.wu
-- strict thread matches above, loose matches on Subject: below --
2020-01-03 8:10 wuxu.wu
2020-01-03 8:10 ` wuxu.wu
[not found] ` <1578039033-6458-1-git-send-email-wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-01-03 11:53 ` Roy Spliet
2020-01-03 11:58 ` Roy Spliet
[not found] ` <fd3273d3-5814-be43-dbec-e49bc7990705-NQbd8FSOZ1kdnm+yROfE0A@public.gmane.org>
2020-01-03 13:25 ` Wuxu (Max)
2019-12-20 14:05 wuxu.wu
2019-12-20 14:05 ` wuxu.wu
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.