diff options
author | Theodore Ts'o <tytso@mit.edu> | 2017-08-22 12:19:30 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2017-08-22 12:19:30 -0400 |
commit | a070f28b4f11bccb8d1ffb58b758f4de5d9f642f (patch) | |
tree | 2ec558bc16a376df2b5a885ee7f260824e5a472f /lib | |
parent | 80c21ca370306137d14fd0a6da9fcc3ce898b298 (diff) | |
parent | e84a4a6111ca7e7bdb5af29e81d5322cad12eeb8 (diff) | |
download | e2fsprogs-a070f28b4f11bccb8d1ffb58b758f4de5d9f642f.tar.gz |
Merge branch 'maint' into next
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ext2fs/unix_io.c | 5 | ||||
-rw-r--r-- | lib/support/mkquota.c | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index dc2a2e9fe..98a6756f4 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -185,6 +185,7 @@ static errcode_t raw_read_blk(io_channel channel, actual = pread64(data->dev, buf, size, location); if (actual == size) return 0; + actual = 0; } #elif HAVE_PREAD /* Try an aligned pread */ @@ -195,6 +196,7 @@ static errcode_t raw_read_blk(io_channel channel, actual = pread(data->dev, buf, size, location); if (actual == size) return 0; + actual = 0; } #endif /* HAVE_PREAD */ @@ -247,7 +249,8 @@ bounce_read: return 0; error_out: - memset((char *) buf+actual, 0, size-actual); + if (actual >= 0 && actual < size) + memset((char *) buf+actual, 0, size-actual); if (channel->read_error) retval = (channel->read_error)(channel, block, count, buf, size, actual, retval); diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c index 931a839dd..e65c95b76 100644 --- a/lib/support/mkquota.c +++ b/lib/support/mkquota.c @@ -249,6 +249,11 @@ static int dict_uint_cmp(const void *a, const void *b) return -1; } +static inline int project_quota_valid(quota_ctx_t qctx) +{ + return (EXT2_INODE_SIZE(qctx->fs->super) > EXT2_GOOD_OLD_INODE_SIZE); +} + static inline qid_t get_qid(struct ext2_inode_large *inode, enum quota_type qtype) { unsigned int inode_size; @@ -392,6 +397,8 @@ void quota_data_add(quota_ctx_t qctx, struct ext2_inode_large *inode, inode_uid(*inode), inode_gid(*inode), space); for (qtype = 0; qtype < MAXQUOTAS; qtype++) { + if (qtype == PRJQUOTA && !project_quota_valid(qctx)) + continue; dict = qctx->quota_dict[qtype]; if (dict) { dq = get_dq(dict, get_qid(inode, qtype)); @@ -419,6 +426,8 @@ void quota_data_sub(quota_ctx_t qctx, struct ext2_inode_large *inode, inode_uid(*inode), inode_gid(*inode), space); for (qtype = 0; qtype < MAXQUOTAS; qtype++) { + if (qtype == PRJQUOTA && !project_quota_valid(qctx)) + continue; dict = qctx->quota_dict[qtype]; if (dict) { dq = get_dq(dict, get_qid(inode, qtype)); @@ -444,6 +453,8 @@ void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode_large *inode, inode_uid(*inode), inode_gid(*inode), adjust); for (qtype = 0; qtype < MAXQUOTAS; qtype++) { + if (qtype == PRJQUOTA && !project_quota_valid(qctx)) + continue; dict = qctx->quota_dict[qtype]; if (dict) { dq = get_dq(dict, get_qid(inode, qtype)); |