2015-06-04 10:40:29

by Sergei Zviagintsev

[permalink] [raw]
Subject: [PATCH] kdbus: use FIELD_SIZEOF in kdbus_member_set_user macro

sizeof(((_t *)0)->_m) -> FIELD_SIZEOF(_t, _m)

Use conventional macro according to chapter 17 of
Documentation/CodingStyle.

Signed-off-by: Sergei Zviagintsev <[email protected]>
---
ipc/kdbus/util.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/kdbus/util.h b/ipc/kdbus/util.h
index 9fedf8ab41cd..529716669fe7 100644
--- a/ipc/kdbus/util.h
+++ b/ipc/kdbus/util.h
@@ -40,7 +40,7 @@
({ \
u64 __user *_sz = \
(void __user *)((u8 __user *)(_b) + offsetof(_t, _m)); \
- copy_to_user(_sz, _s, sizeof(((_t *)0)->_m)); \
+ copy_to_user(_sz, _s, FIELD_SIZEOF(_t, _m)); \
})

/**
--
1.8.3.1


2015-06-04 11:30:31

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH] kdbus: use FIELD_SIZEOF in kdbus_member_set_user macro

Hi

On Thu, Jun 4, 2015 at 12:39 PM, Sergei Zviagintsev <[email protected]> wrote:
> sizeof(((_t *)0)->_m) -> FIELD_SIZEOF(_t, _m)
>
> Use conventional macro according to chapter 17 of
> Documentation/CodingStyle.
>
> Signed-off-by: Sergei Zviagintsev <[email protected]>
> ---
> ipc/kdbus/util.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: David Herrmann <[email protected]>

Thanks
David

> diff --git a/ipc/kdbus/util.h b/ipc/kdbus/util.h
> index 9fedf8ab41cd..529716669fe7 100644
> --- a/ipc/kdbus/util.h
> +++ b/ipc/kdbus/util.h
> @@ -40,7 +40,7 @@
> ({ \
> u64 __user *_sz = \
> (void __user *)((u8 __user *)(_b) + offsetof(_t, _m)); \
> - copy_to_user(_sz, _s, sizeof(((_t *)0)->_m)); \
> + copy_to_user(_sz, _s, FIELD_SIZEOF(_t, _m)); \
> })
>
> /**
> --
> 1.8.3.1
>

2015-06-05 11:52:47

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] kdbus: use FIELD_SIZEOF in kdbus_member_set_user macro

On Thu, Jun 04, 2015 at 01:39:30PM +0300, Sergei Zviagintsev wrote:
> sizeof(((_t *)0)->_m) -> FIELD_SIZEOF(_t, _m)
>
> Use conventional macro according to chapter 17 of
> Documentation/CodingStyle.
>
> Signed-off-by: Sergei Zviagintsev <[email protected]>
> Reviewed-by: David Herrmann <[email protected]>

Applied, thanks.

greg k-h