The patch titled Subject: kexec: make kexec_segment user buffer pointer a union has been added to the -mm tree. Its filename is kexec-make-kexec_segment-user-buffer-pointer-a-union.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kexec-make-kexec_segment-user-buffer-pointer-a-union.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kexec-make-kexec_segment-user-buffer-pointer-a-union.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Vivek Goyal <vgoyal@xxxxxxxxxx> Subject: 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@xxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxx> Cc: Michael Kerrisk <mtk.manpages@xxxxxxxxx> Cc: Yinghai Lu <yinghai@xxxxxxxxxx> Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx> Cc: H. Peter Anvin <hpa@xxxxxxxxx> Cc: Matthew Garrett <mjg59@xxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <greg@xxxxxxxxx> Cc: Dave Young <dyoung@xxxxxxxxxx> Cc: WANG Chao <chaowang@xxxxxxxxxx> Cc: Baoquan He <bhe@xxxxxxxxxx> Cc: Andy Lutomirski <luto@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/kexec.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff -puN include/linux/kexec.h~kexec-make-kexec_segment-user-buffer-pointer-a-union include/linux/kexec.h --- a/include/linux/kexec.h~kexec-make-kexec_segment-user-buffer-pointer-a-union +++ a/include/linux/kexec.h @@ -69,7 +69,18 @@ typedef unsigned long kimage_entry_t; #define IND_SOURCE 0x8 struct kexec_segment { - void __user *buf; + /* + * This pointer can point to user memory if kexec_load() system + * call is used or will point to kernel memory if + * kexec_file_load() system call is used. + * + * Use ->buf when expecting to deal with user memory and use ->kbuf + * when expecting to deal with kernel memory. + */ + union { + void __user *buf; + void *kbuf; + }; size_t bufsz; unsigned long mem; size_t memsz; _ Patches currently in -mm which might be from vgoyal@xxxxxxxxxx are origin.patch bin2c-move-bin2c-in-scripts-basic.patch kernel-build-bin2c-based-on-config-option-config_build_bin2c.patch kexec-rename-unusebale_pages-to-unusable_pages.patch kexec-move-segment-verification-code-in-a-separate-function.patch kexec-use-common-function-for-kimage_normal_alloc-and-kimage_crash_alloc.patch resource-provide-new-functions-to-walk-through-resources.patch kexec-make-kexec_segment-user-buffer-pointer-a-union.patch kexec-new-syscall-kexec_file_load-declaration.patch kexec-implementation-of-new-syscall-kexec_file_load.patch purgatory-sha256-provide-implementation-of-sha256-in-purgaotory-context.patch purgatory-core-purgatory-functionality.patch kexec-load-and-relocate-purgatory-at-kernel-load-time.patch kexec-bzimage64-support-for-loading-bzimage-using-64bit-entry.patch kexec-support-for-kexec-on-panic-using-new-system-call.patch kexec-support-kexec-kdump-on-efi-systems.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html