drm/nouveau/bios: fix incorrect kfree in platform_init
Subsystems (3)
PATCH 1/1 drm/nouveau/bios: fix incorrect kfree in platform_init
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.
--- drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +2 -1
@@ -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); }
Signature · 1 line
2.7.4
A message that is not in the archive (sent off-list or not yet received): 1578039033-6458-1-git-send-email-wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
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:
Quoted 14 lines
Hi, I think there has a incorrect kfree in
pcirom_initfunction. Inpcirom_initfunction priv porinter could be free only when priv != null andpriv->romis null.Signed-off-by wuxu.wu <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +0
-0
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c pcirom_init(struct nvkm_bios *bios, const char *name) · line 78
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +2
-1@@ -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 [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
(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:
Quoted 25 lines
Hi, I think there has a incorrect kfree in
pcirom_initfunction. Inpcirom_initfunction priv porinter could be free only when priv != null andpriv->romis null.Signed-off-by wuxu.wu <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +2
-1@@ -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); }
A message that is not in the archive (sent off-list or not yet received): fd3273d3-5814-be43-dbec-e49bc7990705-NQbd8FSOZ1kdnm+yROfE0A@public.gmane.org
Thank you, I got it
Quoted 24 lines · Roy Spliet
(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:
Quoted 19 lines
Hi, I think there has a incorrect kfree in
pcirom_initfunction. Inpcirom_initfunction priv porinter could be free only when priv != null andpriv->romis null.Signed-off-by wuxu.wu <[email protected]>---
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +2
-0@@ -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);
Quoted 8 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c pcirom_init(struct nvkm_bios *bios, const char *name) · line 78
Quoted 6 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +0
-1} - kfree(priv); } pci_disable_rom(pdev); }.
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau