Re: [PATCH-next] modpost: Remove logically dead condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Nicolas,

> vsnprintf prototypes also indicate 'int' as return type.  What is the source of your mentioned findings?
Sorry, I read an alternate vsnprintf implementation and have worded my
patch log wrong based on it.

However there is still an issue that n is declared as size_t which is
a typedef for
an unsigned long, I think the correct solution then is to use a signed
data type here for n?

Thanks for your time and feedback.

Best regards,
Advait

On Thu, 28 Nov 2024 at 02:21, Nicolas Schier <nicolas@xxxxxxxxx> wrote:
>
> On Wed, Nov 27, 2024 at 09:59:04PM +0530 Advait Dhamorikar wrote:
> > In case of failure vsnprintf returns `pos`, an unsigned long integer.
> > An unsigned value can never be negative, so this test will always evaluate
> > the same way.
>
> 'man vsnprintf' on my system reveals a different behaviour:
>
> | The  functions  snprintf() and vsnprintf() do not
> | write more than size bytes (including the  termi‐
> | nating  null  byte  ('\0')).   If  the output was
> | truncated due to  this  limit,  then  the  return
> | value  is the number of characters (excluding the
> | terminating null  byte)  which  would  have  been
> | written  to  the final string if enough space had
> | been available.  Thus, a return value of size  or
> | more  means  that the output was truncated.  (See
> | also below under NOTES.)
> |
> | If an output error  is  encountered,  a  negative
> | value is returned.
>
> vsnprintf prototypes also indicate 'int' as return type.  What is the source of your mentioned findings?
>
> Kind regards,
> Nicolas
>





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux