x86-kernel: fix sparse warnings
Subsystems (4)
PATCH 1/1 x86-kernel: fix sparse warnings
I am trying to solve following sparse warnings. Please give me feedback for the Patch. You can also find updated sparse patches from
http://git.infradead.org/users/jaswinder/sparse-2.6.git
CHECK arch/x86/kernel/process_32.carch/x86/kernel/process_32.c:69:1: warning: symbol 'per_cpu__cpu_number' was not declared. Should it be static? arch/x86/kernel/process_32.c:671:16: warning: symbol 'sys_fork' was not declared. Should it be static? arch/x86/kernel/process_32.c:676:16: warning: symbol 'sys_clone' was not declared. Should it be static? arch/x86/kernel/process_32.c:701:16: warning: symbol 'sys_vfork' was not declared. Should it be static? arch/x86/kernel/process_32.c:709:16: warning: symbol 'sys_execve' was not declared. Should it be static?
CHECK arch/x86/kernel/signal_32.carch/x86/kernel/signal_32.c:49:1: warning: symbol 'sys_sigsuspend' was not declared. Should it be static? arch/x86/kernel/signal_32.c:66:1: warning: symbol 'sys_sigaction' was not declared. Should it be static? arch/x86/kernel/signal_32.c:100:16: warning: symbol 'sys_sigaltstack' was not declared. Should it be static? arch/x86/kernel/signal_32.c:186:26: warning: symbol 'sys_sigreturn' was not declared. Should it be static? arch/x86/kernel/signal_32.c:229:16: warning: symbol 'sys_rt_sigreturn' was not declared. Should it be static? arch/x86/kernel/signal_32.c:658:1: warning: symbol 'do_notify_resume' was not declared. Should it be static?
CHECK arch/x86/kernel/traps_32.carch/x86/kernel/traps_32.c:759:24: warning: symbol 'die_nmi' was not declared. Should it be static? arch/x86/kernel/traps_32.c:974:6: warning: symbol 'math_error' was not declared. Should it be static? arch/x86/kernel/traps_32.c:1034:6: warning: symbol 'do_coprocessor_error' was not declared. Should it be static? arch/x86/kernel/traps_32.c:1118:15: warning: symbol 'patch_espfix_desc' was not declared. Should it be static? arch/x86/kernel/traps_32.c:1176:17: warning: symbol 'math_emulate' was not declared. Should it be static?
CHECK arch/x86/kernel/time_32.carch/x86/kernel/time_32.c:45:5: warning: symbol 'timer_ack' was not declared. Should it be static? arch/x86/kernel/time_32.c:134:13: warning: symbol 'time_init' was not declared. Should it be static?
CHECK arch/x86/kernel/ioport.carch/x86/kernel/ioport.c:133:17: warning: symbol 'sys_iopl' was not declared. Should it be static?
CHECK arch/x86/kernel/ldt.carch/x86/kernel/ldt.c:241:16: warning: symbol 'sys_modify_ldt' was not declared. Should it be static?
CHECK arch/x86/kernel/setup_32.carch/x86/kernel/setup_32.c:344:16: warning: symbol 'max_low_pfn' shadows an earlier one include/linux/bootmem.h:14:22: originally declared herearch/x86/kernel/setup_32.c:761:16: warning: symbol 'max_low_pfn' shadows an earlier one include/linux/bootmem.h:14:22: originally declared herearch/x86/kernel/setup_32.c:202:15: warning: symbol 'saved_video_mode' was not declared. Should it be static? arch/x86/kernel/setup_32.c:240:16: warning: symbol 'user_defined_memmap' was not declared. Should it be static? arch/x86/kernel/setup_32.c:342:22: warning: symbol 'find_max_low_pfn' was not declared. Should it be static? arch/x86/kernel/setup_32.c:649:13: warning: symbol 'setup_bootmem_allocator' was not declared. Should it be static?
CHECK arch/x86/kernel/sys_i386_32.carch/x86/kernel/sys_i386_32.c:25:17: warning: symbol 'sys_mmap2' was not declared. Should it be static? arch/x86/kernel/sys_i386_32.c:66:16: warning: symbol 'old_mmap' was not declared. Should it be static? arch/x86/kernel/sys_i386_32.c:91:16: warning: symbol 'old_select' was not declared. Should it be static? arch/x86/kernel/sys_i386_32.c:106:16: warning: symbol 'sys_ipc' was not declared. Should it be static? arch/x86/kernel/sys_i386_32.c:189:16: warning: symbol 'sys_uname' was not declared. Should it be static? arch/x86/kernel/sys_i386_32.c:200:16: warning: symbol 'sys_olduname' was not declared. Should it be static?
CHECK arch/x86/kernel/e820_32.carch/x86/kernel/e820_32.c:29:15: warning: symbol 'pci_mem_start' was not declared. Should it be static?
CHECK arch/x86/kernel/pci-dma.carch/x86/kernel/pci-dma.c:35:5: warning: symbol 'iommu_bio_merge' was not declared. Should it be static? arch/x86/kernel/pci-dma.c:228:26: warning: incorrect type in assignment (different address spaces)arch/x86/kernel/pci-dma.c:228:26: expected void *virt_basearch/x86/kernel/pci-dma.c:228:26: got void [noderef] <asn:2>*[assigned] mem_basearch/x86/kernel/pci-dma.c:360:22: warning: symbol 'dma_alloc_pages' was not declared. Should it be static?
CHECK arch/x86/kernel/pci-nommu.carch/x86/kernel/pci-nommu.c:86:30: warning: symbol 'nommu_dma_ops' was not declared. Should it be static?
CHECK arch/x86/kernel/i387.carch/x86/kernel/i387.c:524:5: warning: symbol 'dump_fpu' was not declared. Should it be static?
CHECK arch/x86/kernel/ptrace.carch/x86/kernel/ptrace.c:78:19: warning: incorrect type in return expression (different signedness)arch/x86/kernel/ptrace.c:78:19: expected long *arch/x86/kernel/ptrace.c:78:19: got unsigned long *arch/x86/kernel/ptrace.c:1383:5: warning: symbol 'do_syscall_trace' was not declared. Should it be static?
CHECK arch/x86/kernel/tls.carch/x86/kernel/tls.c:92:16: warning: symbol 'sys_set_thread_area' was not declared. Should it be static? arch/x86/kernel/tls.c:142:16: warning: symbol 'sys_get_thread_area' was not declared. Should it be static?
CHECK arch/x86/kernel/acpi/boot.carch/x86/kernel/acpi/boot.c:341:26: warning: symbol 'mp_ioapic_routing' was not declared. Should it be static?
CHECK arch/x86/kernel/cpu/proc.carch/x86/kernel/cpu/proc.c:178:29: warning: symbol 'cpuinfo_op' was not declared. Should it be static?
CHECK arch/x86/kernel/cpu/common.carch/x86/kernel/cpu/common.c:620:13: warning: symbol 'early_cpu_init' was not declared. Should it be static? arch/x86/kernel/cpu/common.c:634:16: warning: symbol 'idle_regs' was not declared. Should it be static?
CHECK arch/x86/kernel/cpu/mtrr/generic.carch/x86/kernel/cpu/mtrr/generic.c:216:12: warning: symbol 'lo' shadows an earlier one arch/x86/kernel/cpu/mtrr/generic.c:198:11: originally declared here
CHECK arch/x86/kernel/mpparse.carch/x86/kernel/mpparse.c:676:13: warning: symbol 'early_get_smp_config' was not declared. Should it be static? arch/x86/kernel/mpparse.c:783:13: warning: symbol 'early_find_smp_config' was not declared. Should it be static?
CHECK arch/x86/kernel/apic_32.carch/x86/kernel/apic_32.c:603:6: warning: symbol 'smp_apic_timer_interrupt' was not declared. Should it be static? arch/x86/kernel/apic_32.c:624:5: warning: symbol 'setup_profiling_timer' was not declared. Should it be static? arch/x86/kernel/apic_32.c:1290:6: warning: symbol 'smp_spurious_interrupt' was not declared. Should it be static? arch/x86/kernel/apic_32.c:1314:6: warning: symbol 'smp_error_interrupt' was not declared. Should it be static? arch/x86/kernel/apic_32.c:1470:28: warning: symbol 'maxcpus' was not declared. Should it be static?
CHECK arch/x86/kernel/vsmp_64.carch/x86/kernel/vsmp_64.c:126:5: warning: symbol 'is_vsmp_box' was not declared. Should it be static? arch/x86/kernel/vsmp_64.c:145:13: warning: symbol 'vsmp_init' was not declared. Should it be static?
CHECK arch/x86/kernel/vm86_32.carch/x86/kernel/vm86_32.c:199:16: warning: symbol 'sys_vm86old' was not declared. Should it be static? arch/x86/kernel/vm86_32.c:229:16: warning: symbol 'sys_vm86' was not declared. Should it be static?
CHECK arch/x86/kernel/head32.carch/x86/kernel/head32.c:11:13: warning: symbol 'i386_start_kernel' was not declared. Should it be static?
--- arch/x86/kernel/cpu/mtrr/generic.c | 8 ++-- arch/x86/kernel/head32.c | 1 + arch/x86/kernel/ldt.c | 1 + arch/x86/kernel/pci-dma.c | 2 +- arch/x86/kernel/process_32.c | 1 + arch/x86/kernel/ptrace.c | 2 +- arch/x86/kernel/setup_32.c | 22 +++++----- arch/x86/kernel/signal_32.c | 1 + arch/x86/kernel/tls.c | 1 + arch/x86/kernel/vm86_32.c | 1 + include/asm-x86/apic.h | 6 +++ include/asm-x86/cpu.h | 1 + include/asm-x86/current_32.h | 2 + include/asm-x86/dma-mapping.h | 1 + include/asm-x86/dma.h | 4 +- include/asm-x86/e820_32.h | 2 + include/asm-x86/i387.h | 1 + include/asm-x86/io_apic.h | 2 + include/asm-x86/mach-default/mach_traps.h | 9 ++++ include/asm-x86/mpspec.h | 3 + include/asm-x86/pci-direct.h | 4 ++ include/asm-x86/processor.h | 5 ++ include/asm-x86/ptrace.h | 2 + include/asm-x86/setup.h | 8 ++++ include/asm-x86/signal.h | 3 + include/asm-x86/syscalls.h | 58 +++++++++++++++++++++++++++++ include/asm-x86/time.h | 3 + include/linux/syscalls.h | 4 ++ 28 files changed, 140 insertions(+), 18 deletions(-) create mode 100644 include/asm-x86/syscalls.h
arch/x86/kernel/cpu/mtrr/generic.c +4 -4
@@ -213,12 +213,12 @@ void __init get_mtrr_state(void) mtrr_state.enabled = (lo &0xc00 ) >>10 ;if (amd_special_default_mtrr ()) { -unsigned lo, hi; +unsigned mlo, mhi;/* TOP_MEM2 */ -rdmsr (MSR_K8_TOP_MEM2 , lo, hi); - tom2 = hi; +rdmsr (MSR_K8_TOP_MEM2 , mlo, mhi); + tom2 = mhi; tom2 <<=32 ; - tom2 |= lo; + tom2 |= mlo; tom2 &=0xffffff8000000ULL ; }if (mtrr_show) {
arch/x86/kernel/head32.c +1 -0
@@ -7,6 +7,7 @@#include <linux/init.h> #include <linux/start_kernel.h> +#include <asm/setup.h> void __init i386_start_kernel (void ) {
arch/x86/kernel/ldt.c +1 -0
@@ -12,6 +12,7 @@#include <linux/mm.h> #include <linux/smp.h> #include <linux/vmalloc.h> +#include <linux/syscalls.h> #include <asm/uaccess.h> #include <asm/system.h>
arch/x86/kernel/pci-dma.c +1 -1
@@ -225,7 +225,7 @@ int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,if (!dev->dma_mem->bitmap) goto free1_out; - dev->dma_mem->virt_base = mem_base; + dev->dma_mem->virt_base = (void *)mem_base; dev->dma_mem->device_base = device_addr; dev->dma_mem->size = pages; dev->dma_mem->flags = flags;
arch/x86/kernel/process_32.c +1 -0
@@ -37,6 +37,7 @@#include <linux/tick.h> #include <linux/percpu.h> #include <linux/prctl.h> +#include <linux/syscalls.h> #include <asm/uaccess.h> #include <asm/pgtable.h>
arch/x86/kernel/ptrace.c +1 -1
@@ -75,7 +75,7 @@ static long *pt_regs_access(struct pt_regs *regs, unsigned long regno) regno >>=2 ;if (regno >FS ) --regno; -return ®s->bx + regno; +return (long *)®s->bx + regno; }static u16 get_segment_reg (struct task_struct *task,unsigned long offset)
arch/x86/kernel/setup_32.c +11 -11
@@ -341,10 +341,10 @@ early_param("reservetop", parse_reservetop);*/ unsigned long __init find_max_low_pfn (void ) { -unsigned long max_low_pfn; +unsigned long maxlow_pfn; - max_low_pfn = max_pfn; -if (max_low_pfn >MAXMEM_PFN ) { + maxlow_pfn = max_pfn; +if (maxlow_pfn >MAXMEM_PFN ) {if (highmem_pages ==-1 ) highmem_pages = max_pfn -MAXMEM_PFN ;if (highmem_pages +MAXMEM_PFN < max_pfn)
@@ -353,7 +353,7 @@ unsigned long __init find_max_low_pfn(void)printk ("only %luMB highmem pages available, ignoring highmem size of %uMB.\n" ,pages_to_mb (max_pfn -MAXMEM_PFN ),pages_to_mb (highmem_pages)); highmem_pages =0 ; } - max_low_pfn =MAXMEM_PFN ; + maxlow_pfn =MAXMEM_PFN ;#ifndef CONFIG_HIGHMEM /* Maximum memory usable is what is directly addressable */ printk(KERN_WARNING "Warning only %ldMB will be used.\n",
@@ -381,18 +381,19 @@ unsigned long __init find_max_low_pfn(void) highmem_pages = 0; }if (highmem_pages) { -if (max_low_pfn-highmem_pages <64 *1024 *1024 /PAGE_SIZE ){ +if (maxlow_pfn-highmem_pages < +64 *1024 *1024 /PAGE_SIZE ){printk (KERN_ERR "highmem size %uMB results in smaller than 64MB lowmem, ignoring it.\n" ,pages_to_mb (highmem_pages)); highmem_pages =0 ; } - max_low_pfn -= highmem_pages; + maxlow_pfn -= highmem_pages; }#else if (highmem_pages)printk (KERN_ERR "ignoring highmem size on non-highmem kernel!\n" );#endif } -return max_low_pfn; +return maxlow_pfn; }#define BIOS_LOWMEM_KILOBYTES 0x413
@@ -446,7 +447,6 @@ static void __init reserve_ebda_region(void) }#ifndef CONFIG_NEED_MULTIPLE_NODES -static void __init setup_bootmem_allocator (void );static unsigned long __init setup_memory (void ) {/*
@@ -758,7 +758,7 @@ DEFINE_PER_CPU(int, x86_cpu_to_node_map) = NUMA_NO_NODE;*/ void __init setup_arch (char **cmdline_p) { -unsigned long max_low_pfn; +unsigned long smax_low_pfn;memcpy (&boot_cpu_data, &new_cpu_data,sizeof (new_cpu_data));pre_setup_arch_hook ();
@@ -830,7 +830,7 @@ void __init setup_arch(char **cmdline_p)if (mtrr_trim_uncached_memory (max_pfn))propagate_e820_map (); - max_low_pfn =setup_memory (); + smax_low_pfn =setup_memory ();#ifdef CONFIG_KVM_CLOCK kvmclock_init ();
@@ -838,7 +838,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_VMI /* -* Must be after max_low_pfn is determined, and before kernel +* Must be after smax_low_pfn is determined, and before kernel * pagetables are setup. */ vmi_init ();
arch/x86/kernel/signal_32.c +1 -0
@@ -20,6 +20,7 @@#include <linux/elf.h> #include <linux/smp.h> #include <linux/mm.h> +#include <linux/syscalls.h> #include <asm/processor.h> #include <asm/ucontext.h>
arch/x86/kernel/tls.c +1 -0
@@ -3,6 +3,7 @@#include <linux/sched.h> #include <linux/user.h> #include <linux/regset.h> +#include <linux/syscalls.h> #include <asm/uaccess.h> #include <asm/desc.h>
arch/x86/kernel/vm86_32.c +1 -0
@@ -41,6 +41,7 @@#include <linux/ptrace.h> #include <linux/audit.h> #include <linux/stddef.h> +#include <linux/syscalls.h> #include <asm/uaccess.h> #include <asm/io.h>
include/asm-x86/apic.h +6 -0
@@ -125,6 +125,12 @@ extern void enable_NMI_through_LVT0(void);*/ #ifdef CONFIG_X86_64 extern void early_init_lapic_mapping (void ); +#else +extern unsigned int __cpuinitdata maxcpus; +extern void smp_apic_timer_interrupt (struct pt_regs *); +extern int setup_profiling_timer (unsigned int ); +extern void smp_spurious_interrupt (struct pt_regs *); +extern void smp_error_interrupt (struct pt_regs *);#endif extern u8 setup_APIC_eilvt_mce (u8 vector,u8 msg_type,u8 mask);
include/asm-x86/cpu.h +1 -0
@@ -17,4 +17,5 @@ extern void arch_unregister_cpu(int);#endif DECLARE_PER_CPU (int, cpu_state); +#endif /* _ASM_I386_CPU_H_ */
include/asm-x86/current_32.h +2 -0
@@ -12,6 +12,8 @@ static __always_inline struct task_struct *get_current(void) return x86_read_percpu(current_task); } +DECLARE_PER_CPU (int, cpu_number); +#define current get_current()#endif /* !(_I386_CURRENT_H) */
include/asm-x86/dma-mapping.h +1 -0
@@ -58,6 +58,7 @@ struct dma_mapping_ops { };extern const struct dma_mapping_ops *dma_ops; +extern const struct dma_mapping_ops nommu_dma_ops;static inline int dma_mapping_error (dma_addr_t dma_addr) {
include/asm-x86/dma.h +3 -1
@@ -150,7 +150,9 @@#define DMA_AUTOINIT 0x10 - +extern int iommu_bio_merge; +struct device ; +struct page *dma_alloc_pages (struct device *,gfp_t ,unsigned );extern spinlock_t dma_spin_lock;static inline unsigned long claim_dma_lock (void )
include/asm-x86/e820_32.h +2 -0
@@ -18,6 +18,8 @@#ifndef __ASSEMBLY__ +extern unsigned long pci_mem_start; +extern struct e820map e820;extern void update_e820 (void );
include/asm-x86/i387.h +1 -0
@@ -24,6 +24,7 @@ extern void mxcsr_feature_mask_init(void);extern int init_fpu (struct task_struct *child); extern asmlinkage void math_state_restore(void);extern void init_thread_xstate (void ); +extern int dump_fpu (struct pt_regs *,struct user_i387_struct *);extern user_regset_active_fn fpregs_active, xfpregs_active;extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get;
include/asm-x86/io_apic.h +2 -0
@@ -122,6 +122,8 @@ struct mp_ioapic_routing {/* I/O APIC entries */ extern struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS ]; +extern struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS ]; +/* # of MP IRQ source entries */ extern int mp_irq_entries;
include/asm-x86/mach-default/mach_traps.h +9 -0
@@ -36,4 +36,13 @@ static inline void reassert_nmi(void)unlock_cmos (); } +/* traps */ +#include <linux/kprobes.h> + +void notrace __kprobes die_nmi(struct pt_regs *, const char *); +void math_error (void __user *); +void do_coprocessor_error (struct pt_regs *,long ); +unsigned long patch_espfix_desc (unsigned long ,unsigned long ); +asmlinkage extern void math_emulate(long); +#endif /* !_MACH_TRAPS_H */
include/asm-x86/mpspec.h +3 -0
@@ -42,6 +42,9 @@ extern unsigned long mp_lapic_addr;extern void find_smp_config (void );extern void get_smp_config (void ); +extern void __init early_get_smp_config (void ); +extern void __init early_find_smp_config (void ); +void __cpuinit generic_processor_info (int apicid,int version);#ifdef CONFIG_ACPI extern void mp_register_ioapic (int id,u32 address,u32 gsi_base);
include/asm-x86/pci-direct.h +4 -0
@@ -14,4 +14,8 @@ extern void write_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset, u8 val);extern int early_pci_allowed (void ); +/* vsmp */ +extern int is_vsmp_box (void ); +extern void __init vsmp_init (void ); +#endif
include/asm-x86/processor.h +5 -0
@@ -128,6 +128,8 @@ struct cpuinfo_x86 {extern struct cpuinfo_x86 boot_cpu_data;extern struct cpuinfo_x86 new_cpu_data; +extern const struct seq_operations cpuinfo_op; +extern struct tss_struct doublefault_tss;extern __u32 cleared_cpu_caps[NCAPINTS ];
@@ -140,6 +142,9 @@ DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);#define current_cpu_data boot_cpu_data#endif +extern void __init early_cpu_init (void ); +extern struct pt_regs *__cpuinit idle_regs (struct pt_regs *); +static inline int hlt_works (int cpu) {#ifdef CONFIG_X86_32
include/asm-x86/ptrace.h +2 -0
@@ -139,6 +139,8 @@ extern unsigned long profile_pc(struct pt_regs *regs);extern unsigned long convert_ip_to_linear (struct task_struct *child,struct pt_regs *regs); +int do_syscall_trace (struct pt_regs *,int ); +#ifdef CONFIG_X86_32 extern void send_sigtrap (struct task_struct *tsk,struct pt_regs *regs,int error_code);
include/asm-x86/setup.h +8 -0
@@ -9,6 +9,14 @@void vsmp_init (void );char *machine_specific_memory_setup (void ); + +extern unsigned long saved_video_mode; +extern int user_defined_memmap; +extern unsigned long find_max_low_pfn (void ); +extern void setup_bootmem_allocator (void ); + +extern void i386_start_kernel (void ); +#ifndef CONFIG_PARAVIRT #define paravirt_post_allocator_init () do {} while (0)#endif
include/asm-x86/signal.h +3 -0
@@ -140,6 +140,9 @@ struct sigaction {struct k_sigaction {struct sigaction sa; }; + +void do_notify_resume (struct pt_regs *,void *,__u32 ); +# else /* __KERNEL__ */ /* Here we must cater to libcs that poke about in kernel headers. */
include/asm-x86/syscalls.h new file +58 -0
58 lines not on this page · raw message
include/asm-x86/time.h +3 -0
@@ -31,6 +31,9 @@ static inline int native_set_wallclock(unsigned long nowtime) return retval; } +extern int timer_ack; +void __init time_init (void ); +#else extern void native_time_init_hook (void );
include/linux/syscalls.h +4 -0
@@ -65,6 +65,10 @@ struct getcpu_cache;#include <linux/quota.h> #include <linux/key.h> +#ifdef CONFIG_X86 +#include <asm/syscalls.h> +#endif +asmlinkage long sys_time (time_t __user *tloc);asmlinkage long sys_stime (time_t __user *tptr); asmlinkage long sys_gettimeofday(struct timeval __user *tv,
Signature · 1 line
1.5.5.1
Quoted 5 lines · Jaswinder Singh
I am trying to solve following sparse warnings. Please give me feedback for the Patch. You can also find updated sparse patches from
http://git.infradead.org/users/jaswinder/sparse-2.6.git28 files changed, 140 insertions(+), 18 deletions(-)
nice.
Could you please split this up into individual commits, and against tip/master:
http://people.redhat.com/mingo/tip.git/README
Granularity should be roughly per file. (i.e. around 30 commits would be fine) That way if any commit is found to be bad we can unapply/revert it just fine without the rest of your changes. Merging into different topic branches is also easier that way.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html