[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <01d4b250-77b7-2534-b350-e8d2ba9b58bd@rasmusvillemoes.dk>
Date: Tue, 11 Jan 2022 17:14:40 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Petr Mladek <pmladek@...e.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>
Subject: Re: [PATCH v1 1/1] vsprintf: Move space out of string literals in
fourcc_string()
On 11/01/2022 16.10, Petr Mladek wrote:
> On Tue 2022-01-11 13:28:21, Andy Shevchenko wrote:
>>>> - strcpy(p, orig & BIT(31) ? " big-endian" : " little-endian");
>>>> + *p++ = ' ';
>>>> + strcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");
>>>> p += strlen(p);
>>>
>>> Hm, ok, those two strings do occur a lot with of_property_read_bool()
>>> and friends. But if you're micro-optimizing anyway, why not drop the
>>> strlen() and say p = stpcpy(...) instead?
>>
>> Why not? I'll do it for v2.
>
> It is safe here. I just hope that it will not trigger reports from
> some tools looking for potential security issues ;-)
>
strcpy() and stpcpy() have exactly the same preconditions and are safe
in exactly the same circumstances, they only differ in their return
value, so I don't see how any tool would warn about a use of (the
only-recently-standardized) stpcpy if it didn't already warn about strcpy.
Rasmus
Powered by blists - more mailing lists