diff --git a/libntfs/mst.c b/libntfs/mst.c index 41f42eeb..530b2722 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -48,7 +48,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) usa_count = le16_to_cpu(b->usa_count) - 1; /* Size and alignment checks. */ if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 || - usa_ofs + (usa_count * 2) > size || + (u32)(usa_ofs + (usa_count * 2)) > size || (size >> NTFS_SECTOR_SIZE_BITS) != usa_count) { errno = EINVAL; return -1; @@ -136,7 +136,7 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size) usa_count = le16_to_cpu(b->usa_count) - 1; /* Size and alignment checks. */ if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 || - usa_ofs + (usa_count * 2) > size || + (u32)(usa_ofs + (usa_count * 2)) > size || (size >> NTFS_SECTOR_SIZE_BITS) != usa_count) { errno = EINVAL; return -1; diff --git a/libntfs/runlist.c b/libntfs/runlist.c index ef76280b..cc17870b 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -771,7 +771,7 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, * Allocate more memory if needed, including space for the * not-mapped and terminator elements. */ - if (((rlpos + 3) * sizeof(*old_rl)) > rlsize) { + if ((int)((rlpos + 3) * sizeof(*old_rl)) > rlsize) { runlist_element *rl2; rlsize += 0x1000; diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 848d9f9d..a8267af5 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -342,7 +342,7 @@ int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, memset(&mbstate, 0, sizeof(mbstate)); for (i = o = 0; i < ins_len; i++) { /* Reallocate memory if necessary or abort. */ - if (o + MB_CUR_MAX > mbs_len) { + if ((int)(o + MB_CUR_MAX) > mbs_len) { char *tc; if (mbs == *outs) { errno = ENAMETOOLONG; diff --git a/libntfs/volume.c b/libntfs/volume.c index 17d32d4b..7099a2af 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -839,7 +839,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) "name!"); goto error_exit; } - for (j = 0; j < u; j++) { + for (j = 0; j < (s32)u; j++) { uchar_t uc = le16_to_cpu(vname[j]); if (uc > 0xff) uc = (uchar_t)'_';