From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: stable-2.02 - libdm: fix dm_list pointer arithmentic for new gcc 10 optimization
Date: Wed, 8 Apr 2020 13:36:24 +0000 (GMT) [thread overview]
Message-ID: <20200408133624.B52C2385BF81@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8f3d2d5e11305b5f3fc7ced7bd2f81412c9e7d93
Commit: 8f3d2d5e11305b5f3fc7ced7bd2f81412c9e7d93
Parent: 2e3791b421a773b637705a3ca7a2ffc4efc8c873
Author: Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate: Wed Mar 4 16:07:22 2020 +0100
Committer: Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Wed Apr 8 15:22:54 2020 +0200
libdm: fix dm_list pointer arithmentic for new gcc 10 optimization
---
libdm/libdevmapper.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 18fe9f9fd..03a43eb45 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -30,6 +30,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <stddef.h> /* offsetof */
#ifndef __GNUC__
# define __typeof__ typeof
@@ -2470,7 +2471,7 @@ struct dm_list *dm_list_next(const struct dm_list *head, const struct dm_list *e
* contained in a structure of type t, return the containing structure.
*/
#define dm_list_struct_base(v, t, head) \
- ((t *)((const char *)(v) - (const char *)&((t *) 0)->head))
+ ((t *)((const char *)(v) - offsetof(t, head)))
/*
* Given the address v of an instance of 'struct dm_list list' contained in
@@ -2483,7 +2484,7 @@ struct dm_list *dm_list_next(const struct dm_list *head, const struct dm_list *e
* return another element f.
*/
#define dm_struct_field(v, t, e, f) \
- (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->f)
+ (((t *)((uintptr_t)(v) - offsetof(t, e))->f)
/*
* Given the address v of a known element e in a known structure of type t,
reply other threads:[~2020-04-08 13:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200408133624.B52C2385BF81@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@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 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.