Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Dec 2020 23:06:44 GMT
From:      Ryan Libby <rlibby@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 62a77bb7edb2 - stable/12 - [libsa] Fix typecast of pointer for st_dev
Message-ID:  <202012292306.0BTN6i9k093341@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=62a77bb7edb28d572c8642edce974631037119bb

commit 62a77bb7edb28d572c8642edce974631037119bb
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2020-04-16 23:29:49 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2020-12-29 23:04:40 +0000

    [libsa] Fix typecast of pointer for st_dev
    
    This code was trying to use a pointer value for st_dev, which is definitely
    not a pointer.  Instead, cast to uintptr_t so it becomes a non-pointer value
    before casting it.
    
    Tested: mips-gcc cross compile, mips32 build
    (cherry picked from commit 6c88ef1c81fce18d6545c4ee8d0df32a25098770)
---
 stand/libsa/pkgfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stand/libsa/pkgfs.c b/stand/libsa/pkgfs.c
index d4794963b2c1..4f52b6bb6b9b 100644
--- a/stand/libsa/pkgfs.c
+++ b/stand/libsa/pkgfs.c
@@ -399,7 +399,7 @@ pkg_stat(struct open_file *f, struct stat *sb)
 	sb->st_size = tf->tf_size;
 	sb->st_blocks = (tf->tf_size + 511) / 512;
 	sb->st_mtime = pkg_atol(tf->tf_hdr.ut_mtime, 12);
-	sb->st_dev = (off_t)tf->tf_pkg;
+	sb->st_dev = (off_t)((uintptr_t)tf->tf_pkg);
 	sb->st_ino = tf->tf_ofs;	/* unique per tf_pkg */
 	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012292306.0BTN6i9k093341>