* [PATCH] sfdisk: fix aliasing warnings
@ 2012-10-10 4:29 Mike Frysinger
2012-10-10 9:26 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2012-10-10 4:29 UTC (permalink / raw)
To: util-linux-ng
Compiles down to the same code.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
fdisks/sfdisk.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/fdisks/sfdisk.c b/fdisks/sfdisk.c
index 3450f52..e59d52a 100644
--- a/fdisks/sfdisk.c
+++ b/fdisks/sfdisk.c
@@ -1561,12 +1561,14 @@ msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
return 0;
}
- unsigned int sig = *(unsigned short *)(s->data + 2);
- if (sig <= 0x1ae
- && *(unsigned short *)(s->data + sig) == 0x55aa
- && (1 & *(unsigned char *)(s->data + sig + 2))) {
+ unsigned short sig, magic;
+ memcpy(&sig, s->data + 2, sizeof(sig));
+ if (sig <= 0x1ae) {
+ memcpy(&magic, s->data + sig, sizeof(magic));
+ if (magic == 0x55aa && (1 & *(unsigned char *)(s->data + sig + 2))) {
warnx(_("DM6 signature found - giving up\n"));
return 0;
+ }
}
for (pno = 0; pno < 4; pno++, cp += sizeof(struct partition)) {
--
1.7.12
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sfdisk: fix aliasing warnings
2012-10-10 4:29 [PATCH] sfdisk: fix aliasing warnings Mike Frysinger
@ 2012-10-10 9:26 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2012-10-10 9:26 UTC (permalink / raw)
To: Mike Frysinger; +Cc: util-linux-ng
On Wed, Oct 10, 2012 at 12:29:54AM -0400, Mike Frysinger wrote:
> fdisks/sfdisk.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-10 9:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10 4:29 [PATCH] sfdisk: fix aliasing warnings Mike Frysinger
2012-10-10 9:26 ` Karel Zak
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).