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: <1471418115-3654-5-git-send-email-famz@redhat.com>
Date:	Wed, 17 Aug 2016 15:15:04 +0800
From:	Fam Zheng <famz@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	linux-nvme@...ts.infradead.org,
	Keith Busch <keith.busch@...el.com>,
	Michael Ellerman <mpe@...erman.id.au>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	linuxppc-dev@...ts.ozlabs.org,
	"Michael S. Tsirkin" <mst@...hat.com>, linux-block@...r.kernel.org,
	Brian Norris <computersforpeace@...il.com>,
	Paul Mackerras <paulus@...ba.org>,
	linux-mtd@...ts.infradead.org, "Ed L. Cashin" <ed.cashin@....org>,
	Jens Axboe <axboe@...nel.dk>, Minchan Kim <minchan@...nel.org>,
	virtualization@...ts.linux-foundation.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
	Nitin Gupta <ngupta@...are.org>,
	David Woodhouse <dwmw2@...radead.org>
Subject: [PATCH 04/15] block: Return error from blk_integrity_add

The kobject_init_and_add call in blk_integrity_add can fail, return the
error code in this case, so that it can be handled in the caller.

Signed-off-by: Fam Zheng <famz@...hat.com>
---
 block/blk-integrity.c | 12 ++++++++----
 include/linux/genhd.h |  4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index d69c5c7..437e09a 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -450,13 +450,17 @@ void blk_integrity_revalidate(struct gendisk *disk)
 			~BDI_CAP_STABLE_WRITES;
 }
 
-void blk_integrity_add(struct gendisk *disk)
+int blk_integrity_add(struct gendisk *disk)
 {
-	if (kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype,
-				 &disk_to_dev(disk)->kobj, "%s", "integrity"))
-		return;
+	int rc;
+
+	rc = kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype,
+				  &disk_to_dev(disk)->kobj, "%s", "integrity");
+	if (rc)
+		return rc;
 
 	kobject_uevent(&disk->integrity_kobj, KOBJ_ADD);
+	return 0;
 }
 
 void blk_integrity_del(struct gendisk *disk)
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index b6fd666..85ce560 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -725,11 +725,11 @@ static inline void part_nr_sects_write(struct hd_struct *part, sector_t size)
 }
 
 #if defined(CONFIG_BLK_DEV_INTEGRITY)
-extern void blk_integrity_add(struct gendisk *);
+extern int blk_integrity_add(struct gendisk *);
 extern void blk_integrity_del(struct gendisk *);
 extern void blk_integrity_revalidate(struct gendisk *);
 #else	/* CONFIG_BLK_DEV_INTEGRITY */
-static inline void blk_integrity_add(struct gendisk *disk) { }
+static inline int blk_integrity_add(struct gendisk *disk) { return 0; }
 static inline void blk_integrity_del(struct gendisk *disk) { }
 static inline void blk_integrity_revalidate(struct gendisk *disk) { }
 #endif	/* CONFIG_BLK_DEV_INTEGRITY */
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ