[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFFsCHzbS6B0+Jbp@smile.fi.intel.com>
Date: Tue, 2 May 2023 23:01:12 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: David Laight <David.Laight@...lab.com>
Cc: 'Rasmus Villemoes' <linux@...musvillemoes.dk>,
Konrad Gräfe <k.graefe@...eware.de>,
Quentin Schulz <quentin.schulz@...obroma-systems.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Kyungmin Park <kyungmin.park@...sung.com>,
Andrzej Pietrasiewicz <andrzej.p@...labora.com>,
Felipe Balbi <balbi@...com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH v3 1/2] vsprintf: Add %p[mM]U for uppercase MAC address
On Fri, Apr 28, 2023 at 07:46:14AM +0000, David Laight wrote:
> From: Rasmus Villemoes
> > Sent: 28 April 2023 07:57
> > On 27/04/2023 13.51, Konrad Gräfe wrote:
> > > The CDC-ECM specification requires an USB gadget to send the host MAC
> > > address as uppercase hex string. This change adds the appropriate
> > > modifier.
> >
> > Thinking more about it, I'm not sure this is appropriate, not for a
> > single user like this. vsprintf() should not and cannot satisfy all
> > possible string formatting requirements for the whole kernel. The %pX
> > extensions are convenient for use with printk() and friends where one
> > needs what in other languages would be "string interpolation" (because
> > then the caller doesn't need to deal with temporary stack buffers and
> > pass them as %s arguments), but for single items like this, snprintf()
> > is not necessarily the right tool for the job.
> >
> > In this case, the caller can just as well call string_upper() on the
> > result, or not use sprintf() at all and do a tiny loop with
> > hex_byte_pack_upper().
>
> Or snprintf with "%02X:%02X:%02X:%02X:%02X:%02X".
Of course this is a step back. Why? Have you read actually what we have in %p
extensions already?
Also, what about stack?
Entire %pm/M exists due to reversed order. Otherwise it's an alias to %6phD or
alike.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists