From: Nicolas Schier <nicolas@fjasle.eu>
To: Advait Dhamorikar <advaitdhamorikar@gmail.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH-next] modpost: Remove logically dead condition
Date: Wed, 27 Nov 2024 21:51:47 +0100 [thread overview]
Message-ID: <Z0eGY_6e9jVMezxE@fjasle.eu> (raw)
In-Reply-To: <20241127162904.28182-1-advaitdhamorikar@gmail.com>
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
next prev parent reply other threads:[~2024-11-27 20:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 16:29 [PATCH-next] modpost: Remove logically dead condition Advait Dhamorikar
2024-11-27 20:51 ` Nicolas Schier [this message]
2024-11-27 21:30 ` Advait Dhamorikar
2024-11-27 23:30 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z0eGY_6e9jVMezxE@fjasle.eu \
--to=nicolas@fjasle.eu \
--cc=advaitdhamorikar@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox