| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 2/2] xfsdump: don't do pointer math twice |
| From: | rjohnston@xxxxxxx |
| Date: | Fri, 21 Aug 2015 09:01:15 -0500 (CDT) |
| Delivered-to: | xfs@xxxxxxxxxxx |
| References: | <20150821193047.661578219@xxxxxxxxxxxxxxxxxxxxxxx> |
| User-agent: | quilt/0.47-15.17.1 |
The pointer math when calculating the address for the call to memset
is incorrect, so we are clearing the wrong memory location.
i2gmap is of type i2gseg_t
oldsize has already computed the pointer offset
oldsize = inomap.hnkmaplen * SEGPERHNK * sizeof(i2gseg_t);
the memset call is using
inomap.i2gmap + oldsize == &inomap.i2gmap[oldsize]
so we were doing the pointer math twice.
We already compensate for the length of each item in oldsize so
adding need to add a (char *) cast to the memset parameter.
---
dump/inomap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: b/dump/inomap.c
===================================================================
--- a/dump/inomap.c
+++ b/dump/inomap.c
@@ -1143,7 +1143,7 @@ cb_add_inogrp( void *arg1, intgen_t fsfd
return -1;
/* zero the new portion of the i2gmap */
- memset(inomap.i2gmap + oldsize,
+ memset((char *)inomap.i2gmap + oldsize,
0,
SEGPERHNK * sizeof(i2gseg_t));
}
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 1/2] xfsdump: use 64bit local variables in inode.c, rjohnston |
|---|---|
| Next by Date: | Re: v5 filesystem corruption due to log recovery lsn ordering, Brian Foster |
| Previous by Thread: | Re: [PATCH 1/2] xfsdump: use 64bit local variables in inode.c, Eric Sandeen |
| Next by Thread: | Re: [PATCH 2/2] xfsdump: don't do pointer math twice, Eric Sandeen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |