Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1704896 > unrolled thread

[PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t

Started byMikko Rapeli <mikko.rapeli@iki.fi>
First post2017-08-06 19:10 +0200
Last post2017-08-09 00:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:10 +0200
    Re: [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t  instead of size_t "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 00:40 +0200

#1704896 — [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2017-08-06 19:10 +0200
Subject[PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t
Message-ID<ubxdU-50T-45@gated-at.bofh.it>
Fixes userspace compilation error:

error: unknown type name ‘size_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: David S. Miller <davem@davemloft.net>
---
 include/uapi/linux/sysctl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
index e13d48058b8d..35a4b8b417fe 100644
--- a/include/uapi/linux/sysctl.h
+++ b/include/uapi/linux/sysctl.h
@@ -35,9 +35,9 @@ struct __sysctl_args {
 	int __user *name;
 	int nlen;
 	void __user *oldval;
-	size_t __user *oldlenp;
+	__kernel_size_t __user *oldlenp;
 	void __user *newval;
-	size_t newlen;
+	__kernel_size_t newlen;
 	unsigned long __unused[4];
 };
 
-- 
2.13.3

[toc] | [next] | [standalone]


#1706912 — Re: [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t

From"Dmitry V. Levin" <ldv@altlinux.org>
Date2017-08-09 00:40 +0200
SubjectRe: [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t
Message-ID<uclkm-6xM-27@gated-at.bofh.it>
In reply to#1704896

[Multipart message — attachments visible in raw view] — view raw

On Sun, Aug 06, 2017 at 06:43:56PM +0200, Mikko Rapeli wrote:
> Fixes userspace compilation error:
> 
> error: unknown type name ‘size_t’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: David S. Miller <davem@davemloft.net>
> ---
>  include/uapi/linux/sysctl.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
> index e13d48058b8d..35a4b8b417fe 100644
> --- a/include/uapi/linux/sysctl.h
> +++ b/include/uapi/linux/sysctl.h
> @@ -35,9 +35,9 @@ struct __sysctl_args {
>  	int __user *name;
>  	int nlen;
>  	void __user *oldval;
> -	size_t __user *oldlenp;
> +	__kernel_size_t __user *oldlenp;
>  	void __user *newval;
> -	size_t newlen;
> +	__kernel_size_t newlen;
>  	unsigned long __unused[4];
>  };

You should be extremely careful when replacing size_t with __kernel_size_t
because e.g. on x32 you have sizeof(size_t) < sizeof(__kernel_size_t).

In case of sysctl.h this replacement would be wrong.

I submitted an alternative fix for this bug some time ago, see
http://lkml.kernel.org/r/20170222230652.GA14373@altlinux.org


-- 
ldv

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web