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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210819025053.222710-8-arequipeno@gmail.com>
Date:   Wed, 18 Aug 2021 21:50:42 -0500
From:   Ian Pilcher <arequipeno@...il.com>
To:     linux-block@...r.kernel.org, linux-leds@...r.kernel.org
Cc:     axboe@...nel.dk, pavel@....cz, kabel@...nel.org,
        linux-kernel@...r.kernel.org, kernelnewbies@...nelnewbies.org
Subject: [RFC PATCH v3 07/18] ledtrig-blkdev: Add function to initialize gendisk ledtrig member

Ensures that gendisk ledtrig member is initialized to NULL, in case the
structure was not allocated with kzalloc() or equivalent

Signed-off-by: Ian Pilcher <arequipeno@...il.com>
---
 include/linux/leds.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/linux/leds.h b/include/linux/leds.h
index 329fd914cf24..6b67650d8797 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -10,6 +10,7 @@
 
 #include <dt-bindings/leds/common.h>
 #include <linux/device.h>
+#include <linux/genhd.h>
 #include <linux/kernfs.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
@@ -599,4 +600,19 @@ static inline void ledtrig_audio_set(enum led_audio type,
 }
 #endif
 
+#ifdef CONFIG_LEDS_TRIGGER_BLKDEV
+/**
+ * ledtrig_blkdev_disk_init - initialize the ledtrig field of a new gendisk
+ * @gd:	the gendisk to be initialized
+ */
+static inline void ledtrig_blkdev_disk_init(struct gendisk *const gd)
+{
+	gd->ledtrig = NULL;
+}
+#else	/* CONFIG_LEDS_TRIGGER_BLKDEV */
+static inline void ledtrig_blkdev_disk_init(const struct gendisk *gd)
+{
+}
+#endif	/* CONFIG_LEDS_TRIGGER_BLKDEV */
+
 #endif		/* __LINUX_LEDS_H_INCLUDED */
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ