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: <20180327183450.34d6e9b6@cakuba.netronome.com>
Date:   Tue, 27 Mar 2018 18:34:50 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     David Ahern <dsa@...ulusnetworks.com>
Cc:     netdev@...r.kernel.org, davem@...emloft.net,
        roopa@...ulusnetworks.com, shm@...ulusnetworks.com,
        jiri@...lanox.com, idosch@...lanox.com, andy.roulin@...il.com
Subject: Re: [PATCH net-next 6/6] netdevsim: Add simple FIB resource
 controller via devlink

On Tue, 27 Mar 2018 18:22:00 -0700, David Ahern wrote:
> +void nsim_devlink_setup(struct netdevsim *ns)
> +{
> +	struct net *net = nsim_to_net(ns);
> +	bool *reg_devlink = net_generic(net, nsim_devlink_id);
> +	struct devlink *devlink;
> +	int err = -ENOMEM;
> +
> +	/* only one device per namespace controls devlink */
> +	if (!*reg_devlink) {
> +		ns->devlink = NULL;
> +		return;
> +	}
> +
> +	devlink = devlink_alloc(&nsim_devlink_ops, 0);
> +	if (!devlink)
> +		return;
> +
> +	err = devlink_register(devlink, &ns->dev);
> +	if (err)
> +		goto err_devlink_free;
> +
> +	err = devlink_resources_register(devlink);
> +	if (err)
> +		goto err_dl_unregister;
> +
> +	ns->devlink = devlink;
> +
> +	*reg_devlink = false;
> +
> +	return;
> +
> +err_dl_unregister:
> +	devlink_unregister(devlink);
> +err_devlink_free:
> +	devlink_free(devlink);
> +}

nit: DaveM expressed preference to not have silent failures in a
     discussion about DebugFS, not sure it applies here, but why not
     handle errors?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ