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: <DE566895-2D1E-4876-882C-731483DE13A7@gmail.com>
Date:   Tue, 19 Sep 2017 12:32:52 +0400
From:   Ilya Matveychikov <matvejchikov@...il.com>
To:     linux-kernel@...r.kernel.org
Subject: [RFC PATCH 2/3] net/dev/core.c: use ksa_parse_ints instead of
 get_options

Signed-off-by: Ilya V. Matveychikov <matvejchikov@...il.com>
---
 net/core/dev.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 8515f8f..acda9ac 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -144,6 +144,7 @@
 #include <linux/netfilter_ingress.h>
 #include <linux/crash_dump.h>
 #include <linux/sctp.h>
+#include <linux/small_array.h>

 #include "net-sysfs.h"

@@ -645,23 +646,18 @@ unsigned long netdev_boot_base(const char *prefix, int unit)
  */
 int __init netdev_boot_setup(char *str)
 {
-	int ints[5];
-	struct ifmap map;
+	struct ifmap map = { 0 };
+	KSA_DECLARE(ints, int, 4);

-	str = get_options(str, ARRAY_SIZE(ints), ints);
+	str = ksa_parse_ints(str, KSA(&ints));
 	if (!str || !*str)
 		return 0;

 	/* Save settings */
-	memset(&map, 0, sizeof(map));
-	if (ints[0] > 0)
-		map.irq = ints[1];
-	if (ints[0] > 1)
-		map.base_addr = ints[2];
-	if (ints[0] > 2)
-		map.mem_start = ints[3];
-	if (ints[0] > 3)
-		map.mem_end = ints[4];
+	map.irq = KSA_GET(&ints, 0, 0);
+	map.base_addr = KSA_GET(&ints, 1, 0);
+	map.mem_start = KSA_GET(&ints, 2, 0);
+	map.mem_end = KSA_GET(&ints, 3, 0);

 	/* Add new entry to the list */
 	return netdev_boot_setup_add(str, &map);
--
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ