Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Apr 2020 23:29:49 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r360027 - head/stand/libsa
Message-ID:  <202004162329.03GNTnZJ014831@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Apr 16 23:29:49 2020
New Revision: 360027
URL: https://svnweb.freebsd.org/changeset/base/360027

Log:
  [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

Modified:
  head/stand/libsa/pkgfs.c

Modified: head/stand/libsa/pkgfs.c
==============================================================================
--- head/stand/libsa/pkgfs.c	Thu Apr 16 23:28:47 2020	(r360026)
+++ head/stand/libsa/pkgfs.c	Thu Apr 16 23:29:49 2020	(r360027)
@@ -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?202004162329.03GNTnZJ014831>