[PATCH] read_cache: cast types from stat to ce_cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cast the system dependent entries of struct stat to unsigned integers
for struct ce_cache just like in other places where we do this already,
to protect against any type conversion issues.

Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
---
This does not fix the "filesystem boundary issue" I reported, but I spotted
this when digging through read-cache.c. My device ids would have issues
when int = short.

 read-cache.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index e381ea5..aa9b847 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -72,11 +72,11 @@ void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
 	ce->ce_mtime.sec = (unsigned int)st->st_mtime;
 	ce->ce_ctime.nsec = ST_CTIME_NSEC(*st);
 	ce->ce_mtime.nsec = ST_MTIME_NSEC(*st);
-	ce->ce_dev = st->st_dev;
-	ce->ce_ino = st->st_ino;
-	ce->ce_uid = st->st_uid;
-	ce->ce_gid = st->st_gid;
-	ce->ce_size = st->st_size;
+	ce->ce_dev = (unsigned int)st->st_dev;
+	ce->ce_ino = (unsigned int)st->st_ino;
+	ce->ce_uid = (unsigned int)st->st_uid;
+	ce->ce_gid = (unsigned int)st->st_gid;
+	ce->ce_size = (unsigned int)st->st_size;
 
 	if (assume_unchanged)
 		ce->ce_flags |= CE_VALID;
-- 
1.7.1.501.g23b46

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]