* [PATCH v1] tpm: use %*ph to print small buffer
@ 2020-07-30 16:16 Andy Shevchenko
2020-07-31 20:43 ` Petr Vorel
2020-08-18 5:33 ` Jarkko Sakkinen
0 siblings, 2 replies; 8+ messages in thread
From: Andy Shevchenko @ 2020-07-30 16:16 UTC (permalink / raw)
To: Peter Huewe, Jarkko Sakkinen, linux-integrity, Jason Gunthorpe
Cc: Andy Shevchenko
Use %*ph format to print small buffer as hex string.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/char/tpm/tpm-sysfs.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
index d52bf4df0bca..e2ff0b273a0f 100644
--- a/drivers/char/tpm/tpm-sysfs.c
+++ b/drivers/char/tpm/tpm-sysfs.c
@@ -56,31 +56,20 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
out = (struct tpm_readpubek_out *)&tpm_buf.data[10];
str +=
sprintf(str,
- "Algorithm: %02X %02X %02X %02X\n"
- "Encscheme: %02X %02X\n"
- "Sigscheme: %02X %02X\n"
- "Parameters: %02X %02X %02X %02X "
- "%02X %02X %02X %02X "
- "%02X %02X %02X %02X\n"
+ "Algorithm: %4ph\n"
+ "Encscheme: %2ph\n"
+ "Sigscheme: %2ph\n"
+ "Parameters: %12ph\n"
"Modulus length: %d\n"
"Modulus:\n",
- out->algorithm[0], out->algorithm[1], out->algorithm[2],
- out->algorithm[3],
- out->encscheme[0], out->encscheme[1],
- out->sigscheme[0], out->sigscheme[1],
- out->parameters[0], out->parameters[1],
- out->parameters[2], out->parameters[3],
- out->parameters[4], out->parameters[5],
- out->parameters[6], out->parameters[7],
- out->parameters[8], out->parameters[9],
- out->parameters[10], out->parameters[11],
+ out->algorithm,
+ out->encscheme,
+ out->sigscheme,
+ out->parameters,
be32_to_cpu(out->keysize));
- for (i = 0; i < 256; i++) {
- str += sprintf(str, "%02X ", out->modulus[i]);
- if ((i + 1) % 16 == 0)
- str += sprintf(str, "\n");
- }
+ for (i = 0; i < 256; i += 16)
+ str += sprintf(str, "%16ph\n", &out->modulus[i]);
out_buf:
tpm_buf_destroy(&tpm_buf);
--
2.27.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1] tpm: use %*ph to print small buffer
2020-07-30 16:16 [PATCH v1] tpm: use %*ph to print small buffer Andy Shevchenko
@ 2020-07-31 20:43 ` Petr Vorel
2020-08-18 5:35 ` Jarkko Sakkinen
2020-08-18 5:33 ` Jarkko Sakkinen
1 sibling, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2020-07-31 20:43 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Peter Huewe, Jarkko Sakkinen, linux-integrity, Jason Gunthorpe
Hi,
> Use %*ph format to print small buffer as hex string.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1] tpm: use %*ph to print small buffer
2020-07-31 20:43 ` Petr Vorel
@ 2020-08-18 5:35 ` Jarkko Sakkinen
0 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2020-08-18 5:35 UTC (permalink / raw)
To: Petr Vorel; +Cc: Andy Shevchenko, Peter Huewe, linux-integrity, Jason Gunthorpe
On Fri, Jul 31, 2020 at 10:43:08PM +0200, Petr Vorel wrote:
> Hi,
>
> > Use %*ph format to print small buffer as hex string.
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Kind regards,
> Petr
Thanks, I'll add this to the commit.
/Jarkko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1] tpm: use %*ph to print small buffer
2020-07-30 16:16 [PATCH v1] tpm: use %*ph to print small buffer Andy Shevchenko
2020-07-31 20:43 ` Petr Vorel
@ 2020-08-18 5:33 ` Jarkko Sakkinen
2020-09-14 16:10 ` Andy Shevchenko
1 sibling, 1 reply; 8+ messages in thread
From: Jarkko Sakkinen @ 2020-08-18 5:33 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Peter Huewe, linux-integrity, Jason Gunthorpe
On Thu, Jul 30, 2020 at 07:16:13PM +0300, Andy Shevchenko wrote:
> Use %*ph format to print small buffer as hex string.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Oh, this is handy, thanks.
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
/Jarkko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1] tpm: use %*ph to print small buffer
2020-08-18 5:33 ` Jarkko Sakkinen
@ 2020-09-14 16:10 ` Andy Shevchenko
2020-09-15 9:43 ` Jarkko Sakkinen
0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2020-09-14 16:10 UTC (permalink / raw)
To: Jarkko Sakkinen; +Cc: Peter Huewe, linux-integrity, Jason Gunthorpe
On Tue, Aug 18, 2020 at 08:33:51AM +0300, Jarkko Sakkinen wrote:
> On Thu, Jul 30, 2020 at 07:16:13PM +0300, Andy Shevchenko wrote:
> > Use %*ph format to print small buffer as hex string.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Oh, this is handy, thanks.
>
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Thanks!
Anybody to push this?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1] tpm: use %*ph to print small buffer
2020-09-14 16:10 ` Andy Shevchenko
@ 2020-09-15 9:43 ` Jarkko Sakkinen
2020-09-15 12:04 ` Andy Shevchenko
0 siblings, 1 reply; 8+ messages in thread
From: Jarkko Sakkinen @ 2020-09-15 9:43 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Peter Huewe, linux-integrity, Jason Gunthorpe
On Mon, Sep 14, 2020 at 07:10:33PM +0300, Andy Shevchenko wrote:
> On Tue, Aug 18, 2020 at 08:33:51AM +0300, Jarkko Sakkinen wrote:
> > On Thu, Jul 30, 2020 at 07:16:13PM +0300, Andy Shevchenko wrote:
> > > Use %*ph format to print small buffer as hex string.
> > >
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > Oh, this is handy, thanks.
> >
> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>
> Thanks!
>
> Anybody to push this?
It's in my tree git://git.infradead.org/users/jjs/linux-tpmdd.git
So next I'll put it to the next PR.
/Jarkko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1] tpm: use %*ph to print small buffer
2020-09-15 9:43 ` Jarkko Sakkinen
@ 2020-09-15 12:04 ` Andy Shevchenko
2020-09-16 15:35 ` Jarkko Sakkinen
0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2020-09-15 12:04 UTC (permalink / raw)
To: Jarkko Sakkinen; +Cc: Peter Huewe, linux-integrity, Jason Gunthorpe
On Tue, Sep 15, 2020 at 12:43:32PM +0300, Jarkko Sakkinen wrote:
> On Mon, Sep 14, 2020 at 07:10:33PM +0300, Andy Shevchenko wrote:
> > On Tue, Aug 18, 2020 at 08:33:51AM +0300, Jarkko Sakkinen wrote:
> > > On Thu, Jul 30, 2020 at 07:16:13PM +0300, Andy Shevchenko wrote:
> > > > Use %*ph format to print small buffer as hex string.
> > > >
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > >
> > > Oh, this is handy, thanks.
> > >
> > > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> >
> > Thanks!
> >
> > Anybody to push this?
>
> It's in my tree git://git.infradead.org/users/jjs/linux-tpmdd.git
>
> So next I'll put it to the next PR.
Thanks!
P.S. I don't see your tree connected to Linux Next, perhaps you can ask Stephen
to add it?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1] tpm: use %*ph to print small buffer
2020-09-15 12:04 ` Andy Shevchenko
@ 2020-09-16 15:35 ` Jarkko Sakkinen
0 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2020-09-16 15:35 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Peter Huewe, linux-integrity, Jason Gunthorpe
On Tue, Sep 15, 2020 at 03:04:11PM +0300, Andy Shevchenko wrote:
> On Tue, Sep 15, 2020 at 12:43:32PM +0300, Jarkko Sakkinen wrote:
> > On Mon, Sep 14, 2020 at 07:10:33PM +0300, Andy Shevchenko wrote:
> > > On Tue, Aug 18, 2020 at 08:33:51AM +0300, Jarkko Sakkinen wrote:
> > > > On Thu, Jul 30, 2020 at 07:16:13PM +0300, Andy Shevchenko wrote:
> > > > > Use %*ph format to print small buffer as hex string.
> > > > >
> > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > >
> > > > Oh, this is handy, thanks.
> > > >
> > > > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > >
> > > Thanks!
> > >
> > > Anybody to push this?
> >
> > It's in my tree git://git.infradead.org/users/jjs/linux-tpmdd.git
> >
> > So next I'll put it to the next PR.
>
> Thanks!
>
> P.S. I don't see your tree connected to Linux Next, perhaps you can ask Stephen
> to add it?
The next branch is connected to the linux-next. I've just forgot to
rebase that branch (will do now).
> --
> With Best Regards,
> Andy Shevchenko
/Jarkko
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-16 21:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 16:16 [PATCH v1] tpm: use %*ph to print small buffer Andy Shevchenko
2020-07-31 20:43 ` Petr Vorel
2020-08-18 5:35 ` Jarkko Sakkinen
2020-08-18 5:33 ` Jarkko Sakkinen
2020-09-14 16:10 ` Andy Shevchenko
2020-09-15 9:43 ` Jarkko Sakkinen
2020-09-15 12:04 ` Andy Shevchenko
2020-09-16 15:35 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).