lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241021-dvbdev-fix-uninitialized-return-v1-1-a704945f20e5@kernel.org>
Date: Mon, 21 Oct 2024 09:04:15 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org, 
 llvm@...ts.linux.dev, patches@...ts.linux.dev, 
 kernel test robot <lkp@...el.com>, Dan Carpenter <dan.carpenter@...aro.org>, 
 Nathan Chancellor <nathan@...nel.org>
Subject: [PATCH] media: dvbdev: Avoid using uninitialized ret in
 dvb_register_device()

When CONFIG_DVB_DYNAMIC_MINORS is not enabled, clang warns (or errors
with CONFIG_WERROR=y):

  drivers/media/dvb-core/dvbdev.c:554:10: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
    554 |                 return ret;
        |                        ^~~

Use the return code -EINVAL directly, like the CONFIG_DVB_DYNAMIC_MINORS
block does.

Fixes: 972e63e895ab ("media: dvbdev: prevent the risk of out of memory access")
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/r/202410201717.ULWWdJv8-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@...nel.org>
---
 drivers/media/dvb-core/dvbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 14f323fbada719f717fb7fe9f6f2a3ce81e609a3..5bb36be911f615afa1f3a7a13f974b67b3216edd 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -551,7 +551,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
 		kfree(dvbdev);
 		*pdvbdev = NULL;
 		mutex_unlock(&dvbdev_register_lock);
-		return ret;
+		return -EINVAL;
 	}
 #endif
 	dvbdev->minor = minor;

---
base-commit: ba9cf6b430433e57bfc8072364e944b7c0eca2a4
change-id: 20241021-dvbdev-fix-uninitialized-return-6ef4187dfafa

Best regards,
-- 
Nathan Chancellor <nathan@...nel.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ