[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171025.115324.226089199287535265.davem@davemloft.net>
Date: Wed, 25 Oct 2017 11:53:24 +0900 (KST)
From: David Miller <davem@...emloft.net>
To: steven.lin1@...adcom.com
Cc: netdev@...r.kernel.org, jiri@...lanox.com,
michael.chan@...adcom.com, linville@...driver.com,
gospo@...adcom.com, yuvalm@...lanox.com
Subject: Re: [PATCH net-next v3 01/10] devlink: Add permanent config
parameter get/set operations
From: Steve Lin <steven.lin1@...adcom.com>
Date: Tue, 24 Oct 2017 16:12:33 -0400
> + switch (type) {
> + case NLA_U8:
> + val = *((u8 *)value);
> + if (nla_put_u8(msg, DEVLINK_ATTR_PERM_CONFIG_VALUE, val))
> + goto nest_err;
> + break;
> + case NLA_U16:
> + val = *((u16 *)value);
> + if (nla_put_u16(msg, DEVLINK_ATTR_PERM_CONFIG_VALUE, val))
> + goto nest_err;
> + break;
> + case NLA_U32:
> + val = *((u32 *)value);
> + if (nla_put_u32(msg, DEVLINK_ATTR_PERM_CONFIG_VALUE, val))
> + goto nest_err;
> + break;
> + }
> + nla_nest_end(msg, param_attr);
> +
> + kfree(value);
You have to get the endianness right on these things. Netlink could
theoretically be done over a network, so just saying "device and
system endianness match" is not a valid argument.
Typing and endianness is so important for interfaces like this, so
please contruct the interfaces such that the compiler and 'sparse' can
help us make sure it is done properly.
Thanks.
Powered by blists - more mailing lists