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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181205210034.GA24054@peano>
Date:   Wed, 5 Dec 2018 22:00:34 +0100
From:   Sicilia Cristian <sicilia.cristian@...il.com>
To:     Bryan O'Donoghue <pure.logic@...us-software.ie>
Cc:     Johan Hovold <johan@...nel.org>, Alex Elder <elder@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        greybus-dev@...ts.linaro.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] staging: greybus: Added space between string
 concatenated

On Wed, Dec 05, 2018 at 10:12:24AM +0000, Bryan O'Donoghue wrote:
> On 04/12/2018 20:58, Cristian Sicilia wrote:
> >Some concatenated strings are now spaced.
> >
> >Signed-off-by: Cristian Sicilia <sicilia.cristian@...il.com>
> >---
> >  drivers/staging/greybus/loopback.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> >diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> >index 1085e06..acfa392 100644
> >--- a/drivers/staging/greybus/loopback.c
> >+++ b/drivers/staging/greybus/loopback.c
> >@@ -141,7 +141,7 @@ static ssize_t name##_##field##_show(struct device *dev,	\
> >  	/* Report 0 for min and max if no transfer successed */		\
> >  	if (!gb->requests_completed)					\
> >  		return sprintf(buf, "0\n");				\
> >-	return sprintf(buf, "%"#type"\n", gb->name.field);	\
> >+	return sprintf(buf, "%" #type "\n", gb->name.field);		\
> >  }									\
> >  static DEVICE_ATTR_RO(name##_##field)
> >@@ -176,7 +176,7 @@ static ssize_t field##_show(struct device *dev,				\
> >  			    char *buf)					\
> >  {									\
> >  	struct gb_loopback *gb = dev_get_drvdata(dev);			\
> >-	return sprintf(buf, "%"#type"\n", gb->field);			\
> >+	return sprintf(buf, "%" #type "\n", gb->field);			\
> >  }									\
> >  static ssize_t field##_store(struct device *dev,			\
> >  			    struct device_attribute *attr,		\
> >@@ -212,7 +212,7 @@ static ssize_t field##_show(struct device *dev,				\
> >  			    char *buf)					\
> >  {									\
> >  	struct gb_loopback *gb = dev_get_drvdata(dev);			\
> >-	return sprintf(buf, "%"#type"\n", gb->field);			\
> >+	return sprintf(buf, "%" #type "\n", gb->field);			\
> >  }									\
> >  static ssize_t field##_store(struct device *dev,			\
> >  			    struct device_attribute *attr,		\
> >
> Eh.
> 
> But doesn't all of this add an extra two space to the resultant string ?
> 
> Not what we want.

It doesn't change the result string, if I well understand the question your
doubt is if there are some space between % and type or between type and
end of line:

This (supposing type=u and field=min):
 return sprintf(buf, "%"#type"\n", gb->field);
Will expanded in this
 return sprintf(buf, "%""u""\n", gb->min);
That's is like:
 return sprintf(buf, "%u\n", gb->min);

This (supposing type=u and field=min):
return sprintf(buf, "%" #type "\n", gb->field);
Will expanded in this
 return sprintf(buf, "%" "u" "\n", gb->min);
That's is like:
 return sprintf(buf, "%u\n", gb->min);

> 
> ---
> bod

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ