aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-30 16:05:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-30 16:05:30 -0400
commit22d3e0c36e10296da91e3bb8826592bacfbf4b9c (patch)
tree6148e2c2d60a255c33fffaf13f8eb48a42288445
parent0fbc4aeabc91f2e39e0dffebe8f81a0eb3648d97 (diff)
parent73d1c580f92b203f4c3a189ee98c917c65712f7e (diff)
Merge tag 'kbuild-fixes-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - introduce __diag_* macros and suppress -Wattribute-alias warnings from GCC 8 - fix stack protector test script for x86_64 - fix line number handling in Kconfig - document that '#' starts a comment in Kconfig - handle P_SYMBOL property in dump debugging of Kconfig - correct help message of LD_DEAD_CODE_DATA_ELIMINATION - fix occasional segmentation faults in Kconfig * tag 'kbuild-fixes-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kconfig: loop boundary condition fix kbuild: reword help of LD_DEAD_CODE_DATA_ELIMINATION kconfig: handle P_SYMBOL in print_symbol() kconfig: document Kconfig source file comments kconfig: fix line numbers for if-entries in menu tree stack-protector: Fix test with 32-bit userland and CONFIG_64BIT=y powerpc: Remove -Wattribute-alias pragmas disable -Wattribute-alias warning for SYSCALL_DEFINEx() kbuild: add macro for controlling warnings to linux/compiler.h
-rw-r--r--Documentation/kbuild/kconfig-language.txt6
-rw-r--r--arch/powerpc/kernel/pci_32.c4
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/kernel/rtas.c4
-rw-r--r--arch/powerpc/kernel/signal_32.c8
-rw-r--r--arch/powerpc/kernel/signal_64.c4
-rw-r--r--arch/powerpc/kernel/syscalls.c4
-rw-r--r--arch/powerpc/mm/subpage-prot.c4
-rw-r--r--include/linux/compat.h8
-rw-r--r--include/linux/compiler-gcc.h25
-rw-r--r--include/linux/compiler_types.h18
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--init/Kconfig7
-rwxr-xr-xscripts/gcc-x86_64-has-stack-protector.sh2
-rw-r--r--scripts/kconfig/expr.h3
-rw-r--r--scripts/kconfig/preprocess.c2
-rw-r--r--scripts/kconfig/zconf.y8
17 files changed, 74 insertions, 41 deletions
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index 3534a84d206c..64e0775a62d4 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -430,6 +430,12 @@ This sets the config program's title bar if the config program chooses
430to use it. It should be placed at the top of the configuration, before any 430to use it. It should be placed at the top of the configuration, before any
431other statement. 431other statement.
432 432
433'#' Kconfig source file comment:
434
435An unquoted '#' character anywhere in a source file line indicates
436the beginning of a source file comment. The remainder of that line
437is a comment.
438
433 439
434Kconfig hints 440Kconfig hints
435------------- 441-------------
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 4f861055a852..d63b488d34d7 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -285,9 +285,6 @@ pci_bus_to_hose(int bus)
285 * Note that the returned IO or memory base is a physical address 285 * Note that the returned IO or memory base is a physical address
286 */ 286 */
287 287
288#pragma GCC diagnostic push
289#pragma GCC diagnostic ignored "-Wpragmas"
290#pragma GCC diagnostic ignored "-Wattribute-alias"
291SYSCALL_DEFINE3(pciconfig_iobase, long, which, 288SYSCALL_DEFINE3(pciconfig_iobase, long, which,
292 unsigned long, bus, unsigned long, devfn) 289 unsigned long, bus, unsigned long, devfn)
293{ 290{
@@ -313,4 +310,3 @@ SYSCALL_DEFINE3(pciconfig_iobase, long, which,
313 310
314 return result; 311 return result;
315} 312}
316#pragma GCC diagnostic pop
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 812171c09f42..dff28f903512 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -203,9 +203,6 @@ void pcibios_setup_phb_io_space(struct pci_controller *hose)
203#define IOBASE_ISA_IO 3 203#define IOBASE_ISA_IO 3
204#define IOBASE_ISA_MEM 4 204#define IOBASE_ISA_MEM 4
205 205
206#pragma GCC diagnostic push
207#pragma GCC diagnostic ignored "-Wpragmas"
208#pragma GCC diagnostic ignored "-Wattribute-alias"
209SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus, 206SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus,
210 unsigned long, in_devfn) 207 unsigned long, in_devfn)
211{ 208{
@@ -259,7 +256,6 @@ SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus,
259 256
260 return -EOPNOTSUPP; 257 return -EOPNOTSUPP;
261} 258}
262#pragma GCC diagnostic pop
263 259
264#ifdef CONFIG_NUMA 260#ifdef CONFIG_NUMA
265int pcibus_to_node(struct pci_bus *bus) 261int pcibus_to_node(struct pci_bus *bus)
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 7fb9f83dcde8..8afd146bc9c7 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1051,9 +1051,6 @@ struct pseries_errorlog *get_pseries_errorlog(struct rtas_error_log *log,
1051} 1051}
1052 1052
1053/* We assume to be passed big endian arguments */ 1053/* We assume to be passed big endian arguments */
1054#pragma GCC diagnostic push
1055#pragma GCC diagnostic ignored "-Wpragmas"
1056#pragma GCC diagnostic ignored "-Wattribute-alias"
1057SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) 1054SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
1058{ 1055{
1059 struct rtas_args args; 1056 struct rtas_args args;
@@ -1140,7 +1137,6 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
1140 1137
1141 return 0; 1138 return 0;
1142} 1139}
1143#pragma GCC diagnostic pop
1144 1140
1145/* 1141/*
1146 * Call early during boot, before mem init, to retrieve the RTAS 1142 * Call early during boot, before mem init, to retrieve the RTAS
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 5eedbb282d42..e6474a45cef5 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -1038,9 +1038,6 @@ static int do_setcontext_tm(struct ucontext __user *ucp,
1038} 1038}
1039#endif 1039#endif
1040 1040
1041#pragma GCC diagnostic push
1042#pragma GCC diagnostic ignored "-Wpragmas"
1043#pragma GCC diagnostic ignored "-Wattribute-alias"
1044#ifdef CONFIG_PPC64 1041#ifdef CONFIG_PPC64
1045COMPAT_SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx, 1042COMPAT_SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
1046 struct ucontext __user *, new_ctx, int, ctx_size) 1043 struct ucontext __user *, new_ctx, int, ctx_size)
@@ -1134,7 +1131,6 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
1134 set_thread_flag(TIF_RESTOREALL); 1131 set_thread_flag(TIF_RESTOREALL);
1135 return 0; 1132 return 0;
1136} 1133}
1137#pragma GCC diagnostic pop
1138 1134
1139#ifdef CONFIG_PPC64 1135#ifdef CONFIG_PPC64
1140COMPAT_SYSCALL_DEFINE0(rt_sigreturn) 1136COMPAT_SYSCALL_DEFINE0(rt_sigreturn)
@@ -1231,9 +1227,6 @@ SYSCALL_DEFINE0(rt_sigreturn)
1231 return 0; 1227 return 0;
1232} 1228}
1233 1229
1234#pragma GCC diagnostic push
1235#pragma GCC diagnostic ignored "-Wpragmas"
1236#pragma GCC diagnostic ignored "-Wattribute-alias"
1237#ifdef CONFIG_PPC32 1230#ifdef CONFIG_PPC32
1238SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx, 1231SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx,
1239 int, ndbg, struct sig_dbg_op __user *, dbg) 1232 int, ndbg, struct sig_dbg_op __user *, dbg)
@@ -1337,7 +1330,6 @@ SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx,
1337 return 0; 1330 return 0;
1338} 1331}
1339#endif 1332#endif
1340#pragma GCC diagnostic pop
1341 1333
1342/* 1334/*
1343 * OK, we're invoking a handler 1335 * OK, we're invoking a handler
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index d42b60020389..83d51bf586c7 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -625,9 +625,6 @@ static long setup_trampoline(unsigned int syscall, unsigned int __user *tramp)
625/* 625/*
626 * Handle {get,set,swap}_context operations 626 * Handle {get,set,swap}_context operations
627 */ 627 */
628#pragma GCC diagnostic push
629#pragma GCC diagnostic ignored "-Wpragmas"
630#pragma GCC diagnostic ignored "-Wattribute-alias"
631SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx, 628SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
632 struct ucontext __user *, new_ctx, long, ctx_size) 629 struct ucontext __user *, new_ctx, long, ctx_size)
633{ 630{
@@ -693,7 +690,6 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
693 set_thread_flag(TIF_RESTOREALL); 690 set_thread_flag(TIF_RESTOREALL);
694 return 0; 691 return 0;
695} 692}
696#pragma GCC diagnostic pop
697 693
698 694
699/* 695/*
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 083fa06962fd..466216506eb2 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -62,9 +62,6 @@ out:
62 return ret; 62 return ret;
63} 63}
64 64
65#pragma GCC diagnostic push
66#pragma GCC diagnostic ignored "-Wpragmas"
67#pragma GCC diagnostic ignored "-Wattribute-alias"
68SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len, 65SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
69 unsigned long, prot, unsigned long, flags, 66 unsigned long, prot, unsigned long, flags,
70 unsigned long, fd, unsigned long, pgoff) 67 unsigned long, fd, unsigned long, pgoff)
@@ -78,7 +75,6 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
78{ 75{
79 return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT); 76 return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT);
80} 77}
81#pragma GCC diagnostic pop
82 78
83#ifdef CONFIG_PPC32 79#ifdef CONFIG_PPC32
84/* 80/*
diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
index 75cb646a79c3..9d16ee251fc0 100644
--- a/arch/powerpc/mm/subpage-prot.c
+++ b/arch/powerpc/mm/subpage-prot.c
@@ -186,9 +186,6 @@ static void subpage_mark_vma_nohuge(struct mm_struct *mm, unsigned long addr,
186 * in a 2-bit field won't allow writes to a page that is otherwise 186 * in a 2-bit field won't allow writes to a page that is otherwise
187 * write-protected. 187 * write-protected.
188 */ 188 */
189#pragma GCC diagnostic push
190#pragma GCC diagnostic ignored "-Wpragmas"
191#pragma GCC diagnostic ignored "-Wattribute-alias"
192SYSCALL_DEFINE3(subpage_prot, unsigned long, addr, 189SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,
193 unsigned long, len, u32 __user *, map) 190 unsigned long, len, u32 __user *, map)
194{ 191{
@@ -272,4 +269,3 @@ SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,
272 up_write(&mm->mmap_sem); 269 up_write(&mm->mmap_sem);
273 return err; 270 return err;
274} 271}
275#pragma GCC diagnostic pop
diff --git a/include/linux/compat.h b/include/linux/compat.h
index b1a5562b3215..c68acc47da57 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -72,6 +72,9 @@
72 */ 72 */
73#ifndef COMPAT_SYSCALL_DEFINEx 73#ifndef COMPAT_SYSCALL_DEFINEx
74#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 74#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
75 __diag_push(); \
76 __diag_ignore(GCC, 8, "-Wattribute-alias", \
77 "Type aliasing is used to sanitize syscall arguments");\
75 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 78 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
76 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ 79 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
77 __attribute__((alias(__stringify(__se_compat_sys##name)))); \ 80 __attribute__((alias(__stringify(__se_compat_sys##name)))); \
@@ -80,8 +83,11 @@
80 asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ 83 asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
81 asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 84 asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
82 { \ 85 { \
83 return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\ 86 long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
87 __MAP(x,__SC_TEST,__VA_ARGS__); \
88 return ret; \
84 } \ 89 } \
90 __diag_pop(); \
85 static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 91 static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
86#endif /* COMPAT_SYSCALL_DEFINEx */ 92#endif /* COMPAT_SYSCALL_DEFINEx */
87 93
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index f1a7492a5cc8..fd282c7d3e5e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -347,3 +347,28 @@
347#if GCC_VERSION >= 50100 347#if GCC_VERSION >= 50100
348#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 348#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
349#endif 349#endif
350
351/*
352 * Turn individual warnings and errors on and off locally, depending
353 * on version.
354 */
355#define __diag_GCC(version, severity, s) \
356 __diag_GCC_ ## version(__diag_GCC_ ## severity s)
357
358/* Severity used in pragma directives */
359#define __diag_GCC_ignore ignored
360#define __diag_GCC_warn warning
361#define __diag_GCC_error error
362
363/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */
364#if GCC_VERSION >= 40600
365#define __diag_str1(s) #s
366#define __diag_str(s) __diag_str1(s)
367#define __diag(s) _Pragma(__diag_str(GCC diagnostic s))
368#endif
369
370#if GCC_VERSION >= 80000
371#define __diag_GCC_8(s) __diag(s)
372#else
373#define __diag_GCC_8(s)
374#endif
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 6b79a9bba9a7..a8ba6b04152c 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -271,4 +271,22 @@ struct ftrace_likely_data {
271# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) 271# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
272#endif 272#endif
273 273
274#ifndef __diag
275#define __diag(string)
276#endif
277
278#ifndef __diag_GCC
279#define __diag_GCC(version, severity, string)
280#endif
281
282#define __diag_push() __diag(push)
283#define __diag_pop() __diag(pop)
284
285#define __diag_ignore(compiler, version, option, comment) \
286 __diag_ ## compiler(version, ignore, option)
287#define __diag_warn(compiler, version, option, comment) \
288 __diag_ ## compiler(version, warn, option)
289#define __diag_error(compiler, version, option, comment) \
290 __diag_ ## compiler(version, error, option)
291
274#endif /* __LINUX_COMPILER_TYPES_H */ 292#endif /* __LINUX_COMPILER_TYPES_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 73810808cdf2..a368a68cb667 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -231,6 +231,9 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
231 */ 231 */
232#ifndef __SYSCALL_DEFINEx 232#ifndef __SYSCALL_DEFINEx
233#define __SYSCALL_DEFINEx(x, name, ...) \ 233#define __SYSCALL_DEFINEx(x, name, ...) \
234 __diag_push(); \
235 __diag_ignore(GCC, 8, "-Wattribute-alias", \
236 "Type aliasing is used to sanitize syscall arguments");\
234 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ 237 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
235 __attribute__((alias(__stringify(__se_sys##name)))); \ 238 __attribute__((alias(__stringify(__se_sys##name)))); \
236 ALLOW_ERROR_INJECTION(sys##name, ERRNO); \ 239 ALLOW_ERROR_INJECTION(sys##name, ERRNO); \
@@ -243,6 +246,7 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
243 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ 246 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
244 return ret; \ 247 return ret; \
245 } \ 248 } \
249 __diag_pop(); \
246 static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 250 static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
247#endif /* __SYSCALL_DEFINEx */ 251#endif /* __SYSCALL_DEFINEx */
248 252
diff --git a/init/Kconfig b/init/Kconfig
index fde3d09e8b27..041f3a022122 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1051,10 +1051,9 @@ config LD_DEAD_CODE_DATA_ELIMINATION
1051 depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION 1051 depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
1052 depends on EXPERT 1052 depends on EXPERT
1053 help 1053 help
1054 Select this if the architecture wants to do dead code and 1054 Enable this if you want to do dead code and data elimination with
1055 data elimination with the linker by compiling with 1055 the linker by compiling with -ffunction-sections -fdata-sections,
1056 -ffunction-sections -fdata-sections, and linking with 1056 and linking with --gc-sections.
1057 --gc-sections.
1058 1057
1059 This can reduce on disk and in-memory size of the kernel 1058 This can reduce on disk and in-memory size of the kernel
1060 code and static data, particularly for small configs and 1059 code and static data, particularly for small configs and
diff --git a/scripts/gcc-x86_64-has-stack-protector.sh b/scripts/gcc-x86_64-has-stack-protector.sh
index 3755af0cd9f7..75e4e22b986a 100755
--- a/scripts/gcc-x86_64-has-stack-protector.sh
+++ b/scripts/gcc-x86_64-has-stack-protector.sh
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs" 4echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -m64 -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 94a383b21df6..f63b41b0dd49 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -171,6 +171,9 @@ struct symbol {
171 * config BAZ 171 * config BAZ
172 * int "BAZ Value" 172 * int "BAZ Value"
173 * range 1..255 173 * range 1..255
174 *
175 * Please, also check zconf.y:print_symbol() when modifying the
176 * list of property types!
174 */ 177 */
175enum prop_type { 178enum prop_type {
176 P_UNKNOWN, 179 P_UNKNOWN,
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index 65da87fce907..5ca2df790d3c 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -156,7 +156,7 @@ static char *do_shell(int argc, char *argv[])
156 nread--; 156 nread--;
157 157
158 /* remove trailing new lines */ 158 /* remove trailing new lines */
159 while (buf[nread - 1] == '\n') 159 while (nread > 0 && buf[nread - 1] == '\n')
160 nread--; 160 nread--;
161 161
162 buf[nread] = 0; 162 buf[nread] = 0;
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 6f9b0aa32a82..4b68272ebdb9 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE];
31static struct menu *current_menu, *current_entry; 31static struct menu *current_menu, *current_entry;
32 32
33%} 33%}
34%expect 32 34%expect 31
35 35
36%union 36%union
37{ 37{
@@ -337,7 +337,7 @@ choice_block:
337 337
338/* if entry */ 338/* if entry */
339 339
340if_entry: T_IF expr nl 340if_entry: T_IF expr T_EOL
341{ 341{
342 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 342 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
343 menu_add_entry(NULL); 343 menu_add_entry(NULL);
@@ -717,6 +717,10 @@ static void print_symbol(FILE *out, struct menu *menu)
717 print_quoted_string(out, prop->text); 717 print_quoted_string(out, prop->text);
718 fputc('\n', out); 718 fputc('\n', out);
719 break; 719 break;
720 case P_SYMBOL:
721 fputs( " symbol ", out);
722 fprintf(out, "%s\n", prop->sym->name);
723 break;
720 default: 724 default:
721 fprintf(out, " unknown prop %d!\n", prop->type); 725 fprintf(out, " unknown prop %d!\n", prop->type);
722 break; 726 break;