From c3248cf0c4904f4d408d24c210e2ceb227686eb5 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Mar 2025 12:33:13 +0100 Subject: [PATCH] Fix cast from pointer to integer in armv7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A pointer may not fit in a off_t type, so we first cast it to intptr_t which must be able to hold it, then compute the diff which should fit in a off_t and perform the cast. Reported-by: Miquel Vidal PiƱol --- src/emu/ovnisort.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emu/ovnisort.c b/src/emu/ovnisort.c index 1af8205..f7542ce 100644 --- a/src/emu/ovnisort.c +++ b/src/emu/ovnisort.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC) +/* Copyright (c) 2021-2025 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ /* This program is a really bad idea. It attempts to sort streams by using a @@ -268,7 +268,7 @@ static void write_stream(int fd, void *base, void *dst, const void *src, size_t size) { while (size > 0) { - off_t offset = (off_t) dst - (off_t) base; + off_t offset = (off_t) ((intptr_t) dst - (intptr_t) base); ssize_t written = pwrite(fd, src, size, offset); if (written < 0)