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:	Thu, 27 Nov 2008 11:40:58 +0100
From:	Patrick McHardy <kaber@...sh.net>
To:	Inaky Perez-Gonzalez <inaky@...ux.intel.com>
CC:	netdev@...r.kernel.org, wimax@...uxwimax.org
Subject: Re: [PATCH 07/39] wimax: generic WiMAX device management (registration,
 deregistration, etc)

Inaky Perez-Gonzalez wrote:
> +static
> +struct nla_policy wimax_gnl_result_policy[WIMAX_GNL_ATTR_MAX + 1] = {

const please for all policies.

> +	// This is really a signed-64 bit number that has to be
> +	// casted from a u64
> +	[WIMAX_GNL_RESULT_CODE] = { .type = NLA_U64 },
> +};
> +*/
> +

> +int wimax_gnl_send_rp_result(struct wimax_dev *wimax_dev,
> +			     struct genl_info *genl_info,
> +			     ssize_t code)
> +{
> +	int result;
> +	struct device *dev = wimax_dev_to_dev(wimax_dev);
> +	void *data;
> +	struct sk_buff *reply_skb;
> +	s64 code_s64 = code;
> +
> +	d_fnstart(3, dev, "(wimax_dev %p info %p code %zd)\n",
> +		  wimax_dev, genl_info, code);
> +	result = -ENOMEM;
> +	reply_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
> +	if (reply_skb == NULL)
> +		goto error_new;
> +	data = genlmsg_put_reply(reply_skb, genl_info,
> +				 &wimax_dev->gnl_family,
> +				 0, WIMAX_GNL_RP_RESULT);
> +	if (data == NULL)
> +		goto error_put_reply;
> +
> +	result = nla_put_u64(reply_skb, WIMAX_GNL_RESULT_CODE, (u64) code_s64);
> +	if (result < 0)
> +		dev_err(dev, "Error putting attribute: %d\n", result);

This is not how netlink protocols should treat errors.
It should return -ENOSPC (everywhere else also of course).

> +
> +	genlmsg_end(reply_skb, data);
> +
> +	result = genlmsg_reply(reply_skb, genl_info);
> +	if (result < 0)
> +		goto error_reply;
> +	d_fnend(3, dev, "(wimax_dev %p info %p code %zd) = 0\n",
> +		wimax_dev, genl_info, code);
> +	return 0;
> +
> +error_reply:
> +error_put_reply:
> +	nlmsg_free(reply_skb);
> +error_new:
> +	d_fnend(3, dev, "(wimax_dev %p info %p code %zd) = %d\n",
> +		wimax_dev, genl_info, code, result);
> +	return result;
> +}
--
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