* [lustre-devel] [PATCH] staging: kernel.h: Prevent macro expantion bug in container_of_safe()
@ 2018-04-26 5:58 Dan Carpenter
2018-04-26 6:14 ` NeilBrown
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-04-26 5:58 UTC (permalink / raw)
To: lustre-devel
There aren't many users of this so it doesn't cause a problem, but we
obviously want to use "__mptr" here instead of "ptr" to prevent the
parameter from being executed twice.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index b5a8e78c6c75..593fb8d250a2 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -978,7 +978,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
!__same_type(*(ptr), void), \
"pointer type mismatch in container_of()"); \
- IS_ERR_OR_NULL(ptr) ? ERR_CAST(ptr) : \
+ IS_ERR_OR_NULL(__mptr) ? ERR_CAST(__mptr) : \
((type *)(__mptr - offsetof(type, member))); })
/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [lustre-devel] [PATCH] staging: kernel.h: Prevent macro expantion bug in container_of_safe()
2018-04-26 5:58 [lustre-devel] [PATCH] staging: kernel.h: Prevent macro expantion bug in container_of_safe() Dan Carpenter
@ 2018-04-26 6:14 ` NeilBrown
0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2018-04-26 6:14 UTC (permalink / raw)
To: lustre-devel
On Thu, Apr 26 2018, Dan Carpenter wrote:
> There aren't many users of this so it doesn't cause a problem, but we
> obviously want to use "__mptr" here instead of "ptr" to prevent the
> parameter from being executed twice.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index b5a8e78c6c75..593fb8d250a2 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -978,7 +978,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
> BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
> !__same_type(*(ptr), void), \
> "pointer type mismatch in container_of()"); \
> - IS_ERR_OR_NULL(ptr) ? ERR_CAST(ptr) : \
> + IS_ERR_OR_NULL(__mptr) ? ERR_CAST(__mptr) : \
> ((type *)(__mptr - offsetof(type, member))); })
>
> /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
Arg, of course. Thanks.
Acked-by: NeilBrown <neilb@suse.com>
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180426/374eb610/attachment.sig>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-26 6:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-26 5:58 [lustre-devel] [PATCH] staging: kernel.h: Prevent macro expantion bug in container_of_safe() Dan Carpenter
2018-04-26 6:14 ` NeilBrown
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).