From: Frederic Germain <frederic.germain@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Frederic Germain <frederic.germain@gmail.com>
Subject: [PATCH 2/4] Fix warning about unaligned pointer in jffs2reader
Date: Tue, 9 Nov 2021 08:17:49 +0000 [thread overview]
Message-ID: <20211109081751.480718-3-frederic.germain@gmail.com> (raw)
In-Reply-To: <20211109081751.480718-1-frederic.germain@gmail.com>
gcc 9.3.0-17ubuntu1~20.04 warning on time_t ctime value is :
Fix taking address of packed member of ‘struct jffs2_raw_inode’ may
result in an unaligned pointer value [-Waddress-of-packed-member].
Signed-off-by: Frederic Germain <frederic.germain@gmail.com>
---
jffsX-utils/jffs2reader.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c
index 083500e..33c5577 100644
--- a/jffsX-utils/jffs2reader.c
+++ b/jffsX-utils/jffs2reader.c
@@ -336,8 +336,9 @@ static void printdir(char *o, size_t size, struct dir *d, const char *path,
d = d->next;
continue;
}
-
- filetime = ctime((const time_t *) &(ri->ctime));
+ time_t _ctime;
+ memcpy(&_ctime, &(ri->ctime), sizeof(time_t));
+ filetime = ctime(&_ctime);
age = time(NULL) - je32_to_cpu(ri->ctime);
mode.v32 = ri->mode.m;
printf("%s %-4d %-8d %-8d ", mode_string(je32_to_cpu(mode)),
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2021-11-09 8:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 8:17 [PATCH 0/4] mtd-utils: adding support for lzma in jffs2reader via liblzma Frederic Germain
2021-11-09 8:17 ` [PATCH 1/4] .gitignore: add new ubiscan utility Frederic Germain
2021-11-09 8:17 ` Frederic Germain [this message]
2021-11-09 8:17 ` [PATCH 3/4] jffsX-utils: add lzma support on jffs2reader Frederic Germain
2021-11-09 8:17 ` [PATCH 4/4] find_raw_inode returns latest version with data of inode Frederic Germain
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=20211109081751.480718-3-frederic.germain@gmail.com \
--to=frederic.germain@gmail.com \
--cc=linux-mtd@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.