From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/2] gfs2_edit savemeta: Use size_t for saved structure lengths
Date: Thu, 17 Aug 2017 18:10:27 +0100 [thread overview]
Message-ID: <20170817171027.8449-2-anprice@redhat.com> (raw)
In-Reply-To: <20170817171027.8449-1-anprice@redhat.com>
Although the value range can fit in an int it's better to use an
unsigned type consistent with sizeof and memcpy.
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/edit/savemeta.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 6ae38274..7ff1b8e4 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -190,11 +190,11 @@ static const char *anthropomorphize(unsigned long long inhuman_value)
return out_val;
}
-static int di_save_len(struct gfs2_buffer_head *bh, uint64_t owner)
+static size_t di_save_len(struct gfs2_buffer_head *bh, uint64_t owner)
{
struct gfs2_inode *inode;
struct gfs2_dinode *dn;
- int len;
+ size_t len;
if (sbd.gfs1)
inode = lgfs2_gfs_inode_get(&sbd, bh);
@@ -234,7 +234,7 @@ static int di_save_len(struct gfs2_buffer_head *bh, uint64_t owner)
* -1 if this isn't gfs metadata.
*/
static int get_gfs_struct_info(struct gfs2_buffer_head *lbh, uint64_t owner,
- int *block_type, int *gstruct_len)
+ int *block_type, size_t *gstruct_len)
{
struct gfs2_meta_header mh;
@@ -423,8 +423,8 @@ static int savemetaclose(struct metafd *mfd)
static int save_bh(struct metafd *mfd, struct gfs2_buffer_head *savebh, uint64_t owner, int *blktype)
{
struct saved_metablock *savedata;
+ size_t blklen;
size_t outsz;
- int blklen;
/* If this isn't metadata and isn't a system file, we don't want it.
Note that we're checking "owner" here rather than blk. That's
--
2.13.5
next prev parent reply other threads:[~2017-08-17 17:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 17:10 [Cluster-devel] [PATCH 1/2] gfs2_edit savemeta: Fix up saving of dinodes/symlinks Andrew Price
2017-08-17 17:10 ` Andrew Price [this message]
2017-08-17 18:09 ` Bob Peterson
2017-08-17 19:35 ` Andrew Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170817171027.8449-2-anprice@redhat.com \
--to=anprice@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).