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>] [day] [month] [year] [list]
Date:   Wed, 27 Feb 2019 13:38:07 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     oulijun <oulijun@...wei.com>
Cc:     David Ahern <dsahern@...il.com>,
        Steve Wise <swise@...ngridcomputing.com>,
        netdev <netdev@...r.kernel.org>,
        RDMA mailing list <linux-rdma@...r.kernel.org>,
        Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH iproute2-next] rdma: Add the prefix for driver attributes

On Wed, Feb 27, 2019 at 07:30:34PM +0800, oulijun wrote:
> 在 2019/2/27 14:41, Leon Romanovsky 写道:
> > From: Leon Romanovsky <leonro@...lanox.com>
> >
> > There is a need to distinguish between driver vs. general exposed
> > attributes. The most common use case is to expose some internal
> > garbage under extremely common and sexy name, e.g. pi, ci e.t.c
> >
> > In order to achieve that, we will add "drv_" prefix to all strings
> > which were received through RDMA_NLDEV_ATTR_DRIVER_* attributes.
> >
> > Signed-off-by: Leon Romanovsky <leonro@...lanox.com>a
> > ---
> >  rdma/utils.c | 34 ++++++++++++++++++++++------------
> >  1 file changed, 22 insertions(+), 12 deletions(-)
> >
> > diff --git a/rdma/utils.c b/rdma/utils.c
> > index 6bc14cd5..1f6bf330 100644
> > --- a/rdma/utils.c
> > +++ b/rdma/utils.c
> > @@ -829,27 +829,37 @@ static int print_driver_entry(struct rd *rd, struct nlattr *key_attr,
> >  				struct nlattr *val_attr,
> >  				enum rdma_nldev_print_type print_type)
> >  {
> > -	const char *key_str = mnl_attr_get_str(key_attr);
> >  	int attr_type = nla_type(val_attr);
> > +	int ret = -EINVAL;
> > +	char *key_str;
> > +
> > +	if (asprintf(&key_str, "drv_%s", mnl_attr_get_str(key_attr)) == -1)
> > +		return -ENOMEM;
> >
> >  	switch (attr_type) {
> >  	case RDMA_NLDEV_ATTR_DRIVER_STRING:
> > -		return print_driver_string(rd, key_str,
> > -				mnl_attr_get_str(val_attr));
> > +		ret = print_driver_string(rd, key_str,
> > +					  mnl_attr_get_str(val_attr));
> > +		break;
> >  	case RDMA_NLDEV_ATTR_DRIVER_S32:
> > -		return print_driver_s32(rd, key_str,
> > -				mnl_attr_get_u32(val_attr), print_type);
> > +		ret = print_driver_s32(rd, key_str, mnl_attr_get_u32(val_attr),
> > +				       print_type);
> > +		break;
> >  	case RDMA_NLDEV_ATTR_DRIVER_U32:
> > -		return print_driver_u32(rd, key_str,
> > -				mnl_attr_get_u32(val_attr), print_type);
> > +		ret = print_driver_u32(rd, key_str, mnl_attr_get_u32(val_attr),
> > +				       print_type);
> > +		break;
> >  	case RDMA_NLDEV_ATTR_DRIVER_S64:
> > -		return print_driver_s64(rd, key_str,
> > -				mnl_attr_get_u64(val_attr), print_type);
> > +		ret = print_driver_s64(rd, key_str, mnl_attr_get_u64(val_attr),
> > +				       print_type);
> > +		break;
> >  	case RDMA_NLDEV_ATTR_DRIVER_U64:
> > -		return print_driver_u64(rd, key_str,
> > -				mnl_attr_get_u64(val_attr), print_type);
> > +		ret = print_driver_u64(rd, key_str, mnl_attr_get_u64(val_attr),
> > +				       print_type);
> > +		break;
> >  	}
> > -	return -EINVAL;
> > +	free(key_str);
> > +	return ret;
> >  }
> >
> >  void print_driver_table(struct rd *rd, struct nlattr *tb)
> > --
> > 2.19.1
> >
> >
> > .
> >
> This is fine to me  and the implementation is more simple.
>
> Tested-by: Lijun Ou <oulijun@...wei.com>

Thanks a lot.

>
> thanks.
>

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

Powered by blists - more mailing lists