From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 03/18] xfsprogs: minor endian annotation fixes
Date: Wed, 10 Oct 2018 15:01:07 -0500 [thread overview]
Message-ID: <1539201682-22198-4-git-send-email-sandeen@redhat.com> (raw)
In-Reply-To: <1539201682-22198-1-git-send-email-sandeen@redhat.com>
No actual bugs, just quiet the sparse checker.
Fixes sparse warnings about this.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
copy/xfs_copy.c | 2 +-
db/crc.c | 6 +++---
db/write.c | 4 ++--
logprint/log_misc.c | 5 +++--
repair/rmap.c | 3 ++-
5 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 64761b3..a6d6703 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -505,7 +505,7 @@ sb_update_uuid(
*/
if (xfs_sb_version_hascrc(sb) && !xfs_sb_version_hasmetauuid(sb) &&
!uuid_equal(&tcarg->uuid, &sb->sb_uuid)) {
- __be32 feat;
+ uint32_t feat;
feat = be32_to_cpu(ag_hdr->xfs_sb->sb_features_incompat);
feat |= XFS_SB_FEAT_INCOMPAT_META_UUID;
diff --git a/db/crc.c b/db/crc.c
index b6775bc..b6612a5 100644
--- a/db/crc.c
+++ b/db/crc.c
@@ -130,7 +130,7 @@ crc_f(
flist_t *sfl;
int bit_length;
int parentoffset;
- int crc;
+ uint32_t crc;
sfl = fl;
parentoffset = 0;
@@ -144,8 +144,8 @@ crc_f(
bit_length *= fcount(sfl->fld, iocur_top->data, parentoffset);
crc = getbitval(iocur_top->data, sfl->offset, bit_length,
BVUNSIGNED);
- /* Off by one.. */
- crc = cpu_to_be32(crc + 1);
+ /* Off by one, ignore endianness - we're just corrupting it. */
+ crc++;
setbitval(iocur_top->data, sfl->offset, bit_length, &crc);
/* Temporarily remove write verifier to write a bad CRC */
diff --git a/db/write.c b/db/write.c
index a48576b..e25d6ea 100644
--- a/db/write.c
+++ b/db/write.c
@@ -525,7 +525,7 @@ convert_arg(
char *endp;
char *rbuf;
char *ostr;
- __u64 *value;
+ __be64 *value;
__u64 val = 0;
if (bit_length <= 64)
@@ -535,7 +535,7 @@ convert_arg(
buf = xrealloc(buf, alloc_size);
memset(buf, 0, alloc_size);
- value = (__u64 *)buf;
+ value = (__be64 *)buf;
rbuf = buf;
if (*arg == '\"') {
diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index e2889f0..e29366a 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -467,6 +467,7 @@ xlog_print_dir2_sf(
xfs_dir2_sf_hdr_t *sfp,
int size)
{
+ __be64 pino; /* parent inode nr */
xfs_ino_t ino;
int count;
int i;
@@ -481,8 +482,8 @@ xlog_print_dir2_sf(
printf(_("SHORTFORM DIRECTORY size %d count %d\n"),
size, sfp->count);
- memmove(&ino, &(sfp->parent), sizeof(ino));
- printf(_(".. ino 0x%llx\n"), (unsigned long long) be64_to_cpu(ino));
+ memmove(&pino, &(sfp->parent), sizeof(pino));
+ printf(_(".. ino 0x%llx\n"), (unsigned long long) be64_to_cpu(pino));
count = sfp->count;
sfep = xfs_dir2_sf_firstentry(sfp);
diff --git a/repair/rmap.c b/repair/rmap.c
index 6de4a10..ebb5a3a 100644
--- a/repair/rmap.c
+++ b/repair/rmap.c
@@ -482,7 +482,8 @@ rmap_store_ag_btree_rec(
*/
agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, agflbp);
b = agfl_bno + ag_rmaps[agno].ar_flcount;
- while (*b != NULLAGBLOCK && b - agfl_bno < libxfs_agfl_size(mp)) {
+ while (*b != cpu_to_be32(NULLAGBLOCK) &&
+ b - agfl_bno < libxfs_agfl_size(mp)) {
error = rmap_add_ag_rec(mp, agno, be32_to_cpu(*b), 1,
XFS_RMAP_OWN_AG);
if (error)
--
1.8.3.1
next prev parent reply other threads:[~2018-10-11 3:25 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 20:01 [PATCH 00/18] xfsprogs: finer-grained sparse fixes Eric Sandeen
2018-10-10 20:01 ` [PATCH 01/18] xfsprogs: enable sparse checking with "make C=[12]" Eric Sandeen
2018-10-10 21:24 ` Darrick J. Wong
2018-10-10 22:18 ` [PATCH 01/18 V2] " Eric Sandeen
2018-10-11 5:57 ` Christoph Hellwig
2018-10-11 14:09 ` Eric Sandeen
2018-10-10 20:01 ` [PATCH 02/18] xfs_db: convert single-bit bitfields to bools Eric Sandeen
2018-10-11 5:58 ` Christoph Hellwig
2018-10-10 20:01 ` Eric Sandeen [this message]
2018-10-11 5:59 ` [PATCH 03/18] xfsprogs: minor endian annotation fixes Christoph Hellwig
2018-10-10 20:01 ` [PATCH 04/18] xfsprogs: avoid redefinition of NBBY Eric Sandeen
2018-10-11 5:59 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 05/18] xfsprogs: include headers for extern variables Eric Sandeen
2018-10-11 5:59 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 06/18] libxfs: add several zone extern declarations to libxfs_priv.h Eric Sandeen
2018-10-11 5:59 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 07/18] libxfs: silence static warnings about platform_* functions Eric Sandeen
2018-10-11 6:00 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 08/18] xfs_io: include io.h to silence static function warnings Eric Sandeen
2018-10-11 6:00 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 09/18] libxfs: silence sparse static function warnings in util.c Eric Sandeen
2018-10-11 6:00 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 10/18] avl64: export avl64_firstino / avl64_firstino from avl64.h Eric Sandeen
2018-10-11 6:01 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 11/18] xfsprogs: misc static function warning fixes Eric Sandeen
2018-10-11 6:01 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 12/18] xfsprogs: don't shadow global libxfs_init x variable Eric Sandeen
2018-10-11 6:02 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 13/18] xfs_io: rename global buffer variable Eric Sandeen
2018-10-11 6:02 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 14/18] xfs_logprint: fix shadow var in xlog_print_trans_buffer Eric Sandeen
2018-10-11 6:03 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 15/18] xfs_repair: fix 'bno' shadow vars in scan.c Eric Sandeen
2018-10-11 6:03 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 16/18] xfs_scrub: remove shadow var from run_scrub_phases() Eric Sandeen
2018-10-11 6:03 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 17/18] xfs_metadump: remove shadow variable Eric Sandeen
2018-10-10 21:34 ` Darrick J. Wong
2018-10-11 6:04 ` Christoph Hellwig
2018-10-10 20:01 ` [PATCH 18/18] libfrog: change project entity variable scope to local/static Eric Sandeen
2018-10-10 21:37 ` [PATCH 00/18] xfsprogs: finer-grained sparse fixes Darrick J. Wong
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=1539201682-22198-4-git-send-email-sandeen@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/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).