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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240216125959.3766309-1-arnd@kernel.org>
Date: Fri, 16 Feb 2024 13:59:50 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Bartosz Golaszewski <brgl@...ev.pl>,
	Linus Walleij <linus.walleij@...aro.org>,
	"Paul E. McKenney" <paulmck@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>,
	Kent Gibson <warthog618@...il.com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] gpio: cdev: avoid uninitialized variable dereference

From: Arnd Bergmann <arnd@...db.de>

The 'gc' variable is never set before it gets printed:

drivers/gpio/gpiolib-cdev.c:2802:11: error: variable 'gc' is uninitialized when used here [-Werror,-Wuninitialized]
 2802 |         chip_dbg(gc, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id);
      |                  ^~
drivers/gpio/gpiolib.h:277:11: note: expanded from macro 'chip_dbg'
  277 |         dev_dbg(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__)
      |                  ^~

Use dev_dbg() directly.

Fixes: 8574b5b47610 ("gpio: cdev: use correct pointer accessors with SRCU")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 drivers/gpio/gpiolib-cdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index 85037fa4925e..d6e8d2b7ac8f 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -2783,7 +2783,6 @@ static const struct file_operations gpio_fileops = {
 
 int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt)
 {
-	struct gpio_chip *gc;
 	int ret;
 
 	cdev_init(&gdev->chrdev, &gpio_fileops);
@@ -2799,7 +2798,7 @@ int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt)
 	if (!rcu_access_pointer(gdev->chip))
 		return -ENODEV;
 
-	chip_dbg(gc, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id);
+	dev_dbg(&gdev->dev, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id);
 
 	return 0;
 }
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ