diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2014-08-08 17:25:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-08 18:57:32 -0400 |
commit | 815d5704a337a662bf960757edbff7a0680d40fd (patch) | |
tree | 54d34d4c4e345e1cfe583c81e3ad4fb585006779 /include/linux/kexec.h | |
parent | 8c86e70acead629aacb4afcd818add66bf6844d9 (diff) |
kexec: make kexec_segment user buffer pointer a union
So far kexec_segment->buf was always a user space pointer as user space
passed the array of kexec_segment structures and kernel copied it.
But with new system call, list of kexec segments will be prepared by
kernel and kexec_segment->buf will point to a kernel memory.
So while I was adding code where I made assumption that ->buf is pointing
to kernel memory, sparse started giving warning.
Make ->buf a union. And where a user space pointer is expected, access it
using ->buf and where a kernel space pointer is expected, access it using
->kbuf. That takes care of sparse warnings.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: WANG Chao <chaowang@redhat.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kexec.h')
-rw-r--r-- | include/linux/kexec.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index d9bb0a57d208..66d56ac0f64c 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
@@ -69,7 +69,18 @@ typedef unsigned long kimage_entry_t; | |||
69 | #define IND_SOURCE 0x8 | 69 | #define IND_SOURCE 0x8 |
70 | 70 | ||
71 | struct kexec_segment { | 71 | struct kexec_segment { |
72 | void __user *buf; | 72 | /* |
73 | * This pointer can point to user memory if kexec_load() system | ||
74 | * call is used or will point to kernel memory if | ||
75 | * kexec_file_load() system call is used. | ||
76 | * | ||
77 | * Use ->buf when expecting to deal with user memory and use ->kbuf | ||
78 | * when expecting to deal with kernel memory. | ||
79 | */ | ||
80 | union { | ||
81 | void __user *buf; | ||
82 | void *kbuf; | ||
83 | }; | ||
73 | size_t bufsz; | 84 | size_t bufsz; |
74 | unsigned long mem; | 85 | unsigned long mem; |
75 | size_t memsz; | 86 | size_t memsz; |