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]
Date:	Wed, 12 Oct 2011 08:50:24 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Mihai Maruseac <mihai.maruseac@...il.com>
Cc:	davem@...emloft.net, eric.dumazet@...il.com,
	mirq-linux@...e.qmqm.pl, therbert@...gle.com, jpirko@...hat.com,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	dbaluta@...acom.com, Mihai Maruseac <mmaruseac@...acom.com>
Subject: Re: [PATCH] dev: use ifindex hash for dev_seq_ops

On Wed, 12 Oct 2011 12:57:26 +0300
Mihai Maruseac <mihai.maruseac@...il.com> wrote:

It looks like you lost the ability to seek back and read the header
(start token).  How is the header handled, is possible to rewind
the file and read it over again?


> +static inline struct net_device *next_dev(struct seq_file *seq, loff_t *pos)
> +{
> +	struct dev_iter_state *state = seq->private;
> +	struct net *net = seq_file_net(seq);
> +	struct net_device *dev = NULL;
> +	loff_t off;
> +
> +	++*pos;
> +	dev = dev_get_by_index_rcu(net, state->ifindex);

Looks good a couple of minor nits.

1. The function should not be inline, since it is in no way performance
   critical. The compiler will probably inline it anyway.

2. dev does not have to be initialized since it is assigned a few
   lines later.  Most programmers are trained now to always initialize
   variables, but often it is unnecessary.

3. The name next_dev() is a little generic; maybe a better name.
--
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