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>] [day] [month] [year] [list]
Date:	Fri, 13 Mar 2015 18:33:40 +0100
From:	Martin Kepplinger <martink@...teo.de>
To:	stefanr@...6.in-berlin.de
Cc:	linux1394-devel@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org, Martin Kepplinger <martink@...teo.de>
Subject: [PATCH] [RFC] firewire: nosy: simplify grabbing context pointer in open()

Signed-off-by: Martin Kepplinger <martink@...teo.de>
---

This is a question: What's the real difference between the two solutions?
I'm not sure if they are equivalent :(


 drivers/firewire/nosy.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c
index 76b2d39..f43619e 100644
--- a/drivers/firewire/nosy.c
+++ b/drivers/firewire/nosy.c
@@ -275,16 +275,12 @@ set_phy_reg(struct pcilynx *lynx, int addr, int val)
 static int
 nosy_open(struct inode *inode, struct file *file)
 {
-	int minor = iminor(inode);
 	struct client *client;
-	struct pcilynx *tmp, *lynx = NULL;
+	struct pcilynx *lynx = NULL;
 
 	mutex_lock(&card_mutex);
-	list_for_each_entry(tmp, &card_list, link)
-		if (tmp->misc.minor == minor) {
-			lynx = lynx_get(tmp);
-			break;
-		}
+	lynx = container_of(file->private_data, struct pcilynx, misc);
+	lynx = lynx_get(lynx);
 	mutex_unlock(&card_mutex);
 	if (lynx == NULL)
 		return -ENODEV;
-- 
2.1.4

--
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