From: Michał Mirosław Date: Thu, 27 Oct 2022 00:06:16 +0000 (+0200) Subject: fbdev/core: Avoid uninitialized read in aperture_remove_conflicting_pci_device() X-Git-Tag: v6.0.7~136 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ad8ba88d68908a49fc03109a66cad0d21d9a75b;p=thirdparty%2Fkernel%2Fstable.git fbdev/core: Avoid uninitialized read in aperture_remove_conflicting_pci_device() commit e0ba1a39b8dfe4f005bebdd85daa89e7382e26b7 upstream. Return on error directly from the BAR-iterating loop instead of break+return. This is actually a cosmetic fix, since it would be highly unusual to have this called for a PCI device without any memory BARs. Fixes: 9d69ef183815 ("fbdev/core: Remove remove_conflicting_pci_framebuffers()") Signed-off-by: Michał Mirosław Signed-off-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/e75323732bedc46d613d72ecb40f97e3bc75eea8.1666829073.git.mirq-linux@rere.qmqm.pl Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c index 9223d3d4089f1..013a382bf5f48 100644 --- a/drivers/video/aperture.c +++ b/drivers/video/aperture.c @@ -351,12 +351,9 @@ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *na size = pci_resource_len(pdev, bar); ret = aperture_remove_conflicting_devices(base, size, primary, name); if (ret) - break; + return ret; } - if (ret) - return ret; - /* * If a driver asked to unregister a platform device registered by * sysfb, then can be assumed that this is a driver for a display