[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8bb4696a-3470-6613-50ce-a002fbce6b23@wanadoo.fr>
Date: Mon, 23 Mar 2020 16:20:06 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: linux-kernel@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] perf cpumap: Use scnprintf instead of snprintf
Le 23/03/2020 à 16:11, David Laight a écrit :
> From: Christophe JAILLET
>> Sent: 22 March 2020 17:25
>> 'scnprintf' returns the number of characters written in the output buffer
>> excluding the trailing '\0', instead of the number of characters which
>> would be generated for the given input.
>>
>> Both function return a number of characters, excluding the trailing '\0'.
>> So comparaison to check if it overflows, should be done against max_size-1.
>> Comparaison against max_size can never match.
> NACK.
> Since snprintf() returns the number of characters it would have
> written to an infinite buffer the comparison can 'match'.
>
> However it should test for (ret >= PATH_MAX).
Agreed. I'll send a V2.
CJ
> David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>
>
Powered by blists - more mailing lists