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: <20190115094134.4c6fd9f2@cakuba.netronome.com>
Date:   Tue, 15 Jan 2019 09:41:34 -0800
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Jiri Pirko <jiri@...nulli.us>
Cc:     davem@...emloft.net, netdev@...r.kernel.org,
        oss-drivers@...ronome.com
Subject: Re: [RFC net-next 1/6] devlink: add device information API

On Tue, 15 Jan 2019 11:15:12 +0100, Jiri Pirko wrote:
> Tue, Jan 15, 2019 at 01:50:03AM CET, jakub.kicinski@...ronome.com wrote:
> >+static int devlink_nl_info_sn_fill(struct sk_buff *msg, struct devlink *devlink,
> >+				   struct netlink_ext_ack *extack)
> >+{
> >+	unsigned char sn[32];  
> 
> :/ Not good to have number directly here.
> 
> >+	size_t len = 0;
> >+	int err;
> >+
> >+	if (!devlink->ops->serial_get)
> >+		return 0;
> >+
> >+	err = devlink->ops->serial_get(devlink, sn, ARRAY_SIZE(sn), &len,
> >+				       extack);  
> 
> Maybe it would be good to have a helper to fill this as well. That way,
> driver could pass buffer of any length and helper would encode it into
> skb.

Ack, will do.  IMHO it's a bit of an overkill, one could "safely
assume" serial number won't be longer than 32 bytes.. :)  But no
problem, will do!

> >+	if (err)
> >+		return err;
> >+
> >+	return nla_put(msg, DEVLINK_ATTR_INFO_SERIAL_NUMBER, len, sn);
> >+}  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ