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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 27 Nov 2008 10:47:21 +0100
From:	Johannes Berg <johannes@...solutions.net>
To:	Inaky Perez-Gonzalez <inaky@...ux.intel.com>
Cc:	netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH 08/39] wimax: Mappping of generic netlink family IDs to
	net devices

On Wed, 2008-11-26 at 15:07 -0800, Inaky Perez-Gonzalez wrote:

> +/*
> + * wimax_get_netdev_by_info - lookup a wimax_dev from the gennetlink info
> + *
> + * The generic netlink family ID has been filled out in the
> + * nlmsghdr->nlmsg_type field, so we pull it from there, look it up in
> + * the mapping table and reference the wimax_dev.
> + *
> + * When done, the reference should be dropped with
> + * 'dev_put(wimax_dev->net_dev)'.
> + */
> +struct wimax_dev *wimax_dev_get_by_genl_info(struct genl_info *info)
> +{
> +	struct wimax_dev *wimax_dev;

= NULL;

> +	int id = info->nlhdr->nlmsg_type;
> +
> +	d_fnstart(3, NULL, "(info %p [id %d])\n", info, id);
> +	spin_lock(&wimax_id_table_lock);
> +	list_for_each_entry(wimax_dev, &wimax_id_table, id_table_node) {
> +		if (wimax_dev->gnl_family.id == id) {
> +			dev_hold(wimax_dev->net_dev);
> +			goto out_unlock;

break;

> +		}
> +	}
> +	d_printf(1, NULL, "wimax: no device associated to ID %d\n", id);

remove debug statement (or make it depend on !wimax_dev)

> +	wimax_dev = NULL;
> +out_unlock:
> +	spin_unlock(&wimax_id_table_lock);
> +	d_fnend(3, NULL, "(info %p) = %p\n", info, wimax_dev);
> +	return wimax_dev;

No need for gotos any more :)

johannes

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ