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: <Pine.LNX.4.64.0703270201410.10410@chino.kir.corp.google.com>
Date:	Tue, 27 Mar 2007 02:03:25 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
cc:	Alan Stern <stern@...land.harvard.edu>,
	linux-kernel@...r.kernel.org
Subject: [patch] usb: call bdev_read_only() only on CONFIG_BLOCK

bdev_read_only() is only defined on CONFIG_BLOCK so we make sure not to
call it unless we have it.  A new static inline function,
is_inode_read_only(), is invoked to call bdev_read_only() on CONFIG_BLOCK
and return zero otherwise.

Cc: Alan Stern <stern@...land.harvard.edu>
Signed-off-by: David Rientjes <rientjes@...gle.com>
---
 drivers/usb/gadget/file_storage.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -3493,6 +3493,14 @@ static int fsg_main_thread(void *fsg_)
 	complete_and_exit(&fsg->thread_notifier, 0);
 }
 
+#ifdef CONFIG_BLOCK
+static inline int is_inode_read_only(struct inode *inode)
+{
+	return bdev_read_only(inode->i_bdev);
+}
+#else
+#define is_inode_read_only(inode)	(0)
+#endif
 
 /*-------------------------------------------------------------------------*/
 
@@ -3528,7 +3536,7 @@ static int open_backing_file(struct lun *curlun, const char *filename)
 	if (filp->f_path.dentry)
 		inode = filp->f_path.dentry->d_inode;
 	if (inode && S_ISBLK(inode->i_mode)) {
-		if (bdev_read_only(inode->i_bdev))
+		if (is_inode_read_only(inode))
 			ro = 1;
 	} else if (!inode || !S_ISREG(inode->i_mode)) {
 		LINFO(curlun, "invalid file type: %s\n", filename);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ