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]
Date:	Wed, 26 Nov 2008 18:38:10 +0100
From:	"Miguel Ángel Álvarez" <gotzoncabanes@...il.com>
To:	netdev@...r.kernel.org, "Krzysztof Halasa" <khc@...waw.pl>
Subject: ixp4xx_hss: Little improvement in create_chan function

Hi.

We are searching for the desired channel three times in the same list.
So I think we could erase two of them. What do you think?

Signed-off-by: Miguel Ángel Álvarez (gotzoncabanes@...il.com)
---
--- ixp4xx_hss.c.orig	2008-11-19 11:26:54.000000000 +0100
+++ ixp4xx_hss.c.create_chan	2008-11-26 18:34:23.000000000 +0100
@@ -2273,10 +2273,13 @@
 	}

 	for (ch = 0; ch < MAX_CHANNELS; ch++)
-		if (channels[ch] && port->channels[ch] != CHANNEL_UNUSED) {
-			printk(KERN_DEBUG "Channel #%i already in use\n", ch);
-			err = -EBUSY;
-			goto free;
+		if (channels[ch]) {
+		 	if (port->channels[ch] != CHANNEL_UNUSED) {
+				printk(KERN_DEBUG "Channel #%i already in use\n", ch);
+				err = -EBUSY;
+				goto free;
+			} else
+				break;
 		}

 	for (id = 0; id < MAX_CHAN_DEVICES; id++)
@@ -2288,10 +2291,6 @@
 		goto free;
 	}

-	for (ch = 0; ch < MAX_CHANNELS; ch++)
-		if (channels[ch])
-			break;
-
 	minor = port->id * MAX_CHAN_DEVICES + ch;
 	chan_dev->id = id;
 	chan_dev->port = port;
@@ -2307,9 +2306,7 @@
 	if ((err = cdev_add(&chan_dev->cdev, MKDEV(chan_major, minor), 1)))
 		goto destroy_device;

-	for (ch = 0; ch < MAX_CHANNELS; ch++)
-		if (channels[ch])
-			port->channels[ch] = id;
+	port->channels[ch] = id;
 	port->chan_devices[id] = chan_dev;
 	dev_set_drvdata(chan_dev->dev, chan_dev);
 	BUG_ON(device_create_file(chan_dev->dev, &chan_attr));

Thanks

Miguel Ángel Álvarez
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ