From: Alviro Iskandar Setiawan <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>,
GNU/Weeb Mailing List <[email protected]>,
Tea Inside Mailing List <[email protected]>,
Ammar Faizi <[email protected]>,
Louvian Lyndal <[email protected]>,
Michael Arminto <[email protected]>
Subject: [PATCH teavpn2 1/3] allocator: Fix `@errno` value when overflow
Date: Fri, 27 May 2022 00:02:25 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
The calloc() function from libc sets the @errno variable to ENOMEM
when overflow, not to EOVERFLOW. Change it to ENOMEM to follow libc
error code.
Fixes: 44f2ca85b3b923b9405b9da89a1e76039b7bafa1 ("allocator: implement custom allocator to guarantee 64-byte alignment")
Cc: Ammar Faizi <[email protected]>
Cc: Louvian Lyndal <[email protected]>
Cc: Michael Arminto <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
src/teavpn2/allocator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/teavpn2/allocator.c b/src/teavpn2/allocator.c
index 5918009..8aeb2d8 100644
--- a/src/teavpn2/allocator.c
+++ b/src/teavpn2/allocator.c
@@ -32,7 +32,7 @@ noinline void *al64_calloc(size_t nmemb, size_t size)
size_t real_size = 0;
if (unlikely(__builtin_mul_overflow(nmemb, size, &real_size))) {
- errno = EOVERFLOW;
+ errno = ENOMEM;
return NULL;
}
--
Alviro Iskandar Setiawan
next prev parent reply other threads:[~2022-05-27 0:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 0:02 [PATCH teavpn2 0/3] teavpn2 fixes Alviro Iskandar Setiawan
2022-05-27 0:02 ` Alviro Iskandar Setiawan [this message]
2022-05-27 0:02 ` [PATCH teavpn2 2/3] net: iface: Fix a potential NULL pointer dereference Alviro Iskandar Setiawan
2022-05-27 0:02 ` [PATCH teavpn2 3/3] arch/linux: syscall: Fix retval checking in libc syscall Alviro Iskandar Setiawan
2022-05-27 0:14 ` [PATCH teavpn2 0/3] teavpn2 fixes Ammar Faizi
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=20220527000227.1253934-2-alviro.iskandar@gnuweeb.org \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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