From 998a4f589d68503f79695f180fdf1742eeb0a39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= Date: Wed, 13 Sep 2023 11:02:36 +0200 Subject: libctf: Sanitize error types for PR 30836 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made sure there is no implicit conversion between signed and unsigned return value for functions setting the ctf_errno value. An example of the problem is that in ctf_member_next, the "offset" value is either 0L or (ctf_id_t)-1L, but it should have been 0L or -1L. The issue was discovered while building a 64 bit ld binary to be executed on the Windows platform. Example object file that demonstrates the issue is attached in the PR. libctf/ Affected functions adjusted. Signed-off-by: Torbjörn SVENSSON Co-Authored-By: Yvan ROUX --- libctf/ctf-util.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'libctf/ctf-util.c') diff --git a/libctf/ctf-util.c b/libctf/ctf-util.c index 9f83ab9..e0d412d 100644 --- a/libctf/ctf-util.c +++ b/libctf/ctf-util.c @@ -255,16 +255,6 @@ ctf_set_open_errno (int *errp, int error) return NULL; } -/* Store the specified error code into the CTF dict, and then return CTF_ERR / - -1 for the benefit of the caller. */ - -unsigned long -ctf_set_errno (ctf_dict_t *fp, int err) -{ - fp->ctf_errno = err; - return CTF_ERR; -} - /* Create a ctf_next_t. */ ctf_next_t * -- cgit v1.1