From 0e0d9a7958849ad7231755f74e861a2bac0da978 Mon Sep 17 00:00:00 2001 From: Anastasia Lyupa Date: Wed, 6 Nov 2013 11:40:04 +0400 Subject: [PATCH] [FIX] warnings in swap_writer build it with -Werror Change-Id: I4bfec0d589f796655ddfabe98946fbac89a38fd7 Signed-off-by: Anastasia Lyupa --- build.sh | 2 +- writer/kernel_operations.h | 4 ++-- writer/swap_writer_module.c | 10 +++++----- writer/swap_writer_module.h | 3 +++ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index 8e947aa..1b3688f 100755 --- a/build.sh +++ b/build.sh @@ -49,7 +49,7 @@ make CROSS_COMPILE=${cross_compile} ARCH=${arch} -C ${kernel_dir} M=${buffer_dir writer_module_name=swap_writer.ko writer_inc=${modules_inc} make CROSS_COMPILE=${cross_compile} ARCH=${arch} -C ${kernel_dir} M=${writer_dir} \ - extra_cflags="-I${modules_dir}" modules || exit 1 + extra_cflags="-Werror -I${modules_dir}" modules || exit 1 driver_module_name=swap_driver.ko make CROSS_COMPILE=${cross_compile} ARCH=${arch} -C ${kernel_dir} M=${driver_dir} \ diff --git a/writer/kernel_operations.h b/writer/kernel_operations.h index 2d856b7..26c2fad 100644 --- a/writer/kernel_operations.h +++ b/writer/kernel_operations.h @@ -63,10 +63,10 @@ static inline u32 get_regs_ret_func(struct pt_regs *regs) u32 *sp, addr = 0; if (user_mode(regs)) { - sp = regs->sp; + sp = (u32 *)regs->sp; if (get_user(addr, sp)) printk("failed to dereference a pointer, sp=%p, " - "pc=%p\n", sp, get_regs_ip(regs)); + "pc=%lx\n", sp, get_regs_ip(regs)); } else { sp = (u32 *)kernel_stack_pointer(regs); addr = *sp; diff --git a/writer/swap_writer_module.c b/writer/swap_writer_module.c index 6aa2d0a..e14defd 100644 --- a/writer/swap_writer_module.c +++ b/writer/swap_writer_module.c @@ -389,7 +389,7 @@ struct proc_unmap { static char *pack_proc_unmap(char *payload, unsigned long start, unsigned long end) { - struct proc_map *pum = (struct proc_unmap *)payload; + struct proc_unmap *pum = (struct proc_unmap *)payload; pum->pid = current->tgid; pum->low_addr = start; @@ -554,8 +554,8 @@ static int pack_args(char *buf, int len, const char *fmt, struct pt_regs *regs) case 'd': /* 4 byte(int) */ if (len < 4) return -ENOMEM; - tmp_u32 = buf; - *tmp_u32 = arg; + tmp_u32 = (u32 *)buf; + *tmp_u32 = (u32)arg; buf += 4; len -= 4; break; @@ -564,7 +564,7 @@ static int pack_args(char *buf, int len, const char *fmt, struct pt_regs *regs) case 'p': /* 8 byte(pointer) */ if (len < 8) return -ENOMEM; - tmp_u64 = buf; + tmp_u64 = (u64 *)buf; *tmp_u64 = (u64)arg; buf += 8; len -= 8; @@ -572,7 +572,7 @@ static int pack_args(char *buf, int len, const char *fmt, struct pt_regs *regs) case 'w': /* 8 byte(double) */ if (len < 8 && (i + 1) < cnt) return -ENOMEM; - tmp_u64 = buf; + tmp_u64 = (u64 *)buf; *tmp_u64 = *((u64 *)&args[i]); ++i; buf += 8; diff --git a/writer/swap_writer_module.h b/writer/swap_writer_module.h index 07aaf0b..510a711 100644 --- a/writer/swap_writer_module.h +++ b/writer/swap_writer_module.h @@ -44,6 +44,9 @@ enum PROBE_SUB_TYPE { }; struct pt_regs; +struct dentry; +struct task_struct; +struct vm_area_struct; int init_msg(size_t buf_size); void uninit_msg(void); -- 2.7.4