RE: [PATCH] kprobes: fix compiler warning for !CONFIG_KPROBES_ON_FTRACE
Muchun Song wrote: > Fix compiler warning(as show below) for !CONFIG_KPROBES_ON_FTRACE. > > kernel/kprobes.c: In function 'kill_kprobe': > kernel/kprobes.c:1116:33: warning: statement with no effect > [-Wunused-value] > 1116 | #define disarm_kprobe_ftrace(p) (-ENODEV) > | ^ > kernel/kprobes.c:2154:3: note: in expansion of macro > 'disarm_kprobe_ftrace' > 2154 | disarm_kprobe_ftrace(p); > > Link: https://lore.kernel.org/r/20200805142136.0331f...@canb.auug.org.au > > Reported-by: Stephen Rothwell > Fixes: 0cb2f1372baa ("kprobes: Fix NULL pointer dereference at > kprobe_ftrace_handler") > Signed-off-by: Muchun Song > --- Acked-by: John Fastabend
Re: [PATCH] kprobes: fix compiler warning for !CONFIG_KPROBES_ON_FTRACE
On Thu, 6 Aug 2020 01:20:46 +0800 Muchun Song wrote: > Fix compiler warning(as show below) for !CONFIG_KPROBES_ON_FTRACE. > > kernel/kprobes.c: In function 'kill_kprobe': > kernel/kprobes.c:1116:33: warning: statement with no effect > [-Wunused-value] > 1116 | #define disarm_kprobe_ftrace(p) (-ENODEV) > | ^ > kernel/kprobes.c:2154:3: note: in expansion of macro > 'disarm_kprobe_ftrace' > 2154 | disarm_kprobe_ftrace(p); > > Link: https://lore.kernel.org/r/20200805142136.0331f...@canb.auug.org.au > > Reported-by: Stephen Rothwell > Fixes: 0cb2f1372baa ("kprobes: Fix NULL pointer dereference at > kprobe_ftrace_handler") > Signed-off-by: Muchun Song Looks good to me. Acked-by: Masami Hiramatsu Thank you! > --- > kernel/kprobes.c | 17 ++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index 503add629599..d36e2b017588 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -1114,9 +1114,20 @@ static int disarm_kprobe_ftrace(struct kprobe *p) > ipmodify ? _ipmodify_enabled : _ftrace_enabled); > } > #else/* !CONFIG_KPROBES_ON_FTRACE */ > -#define prepare_kprobe(p)arch_prepare_kprobe(p) > -#define arm_kprobe_ftrace(p) (-ENODEV) > -#define disarm_kprobe_ftrace(p) (-ENODEV) > +static inline int prepare_kprobe(struct kprobe *p) > +{ > + return arch_prepare_kprobe(p); > +} > + > +static inline int arm_kprobe_ftrace(struct kprobe *p) > +{ > + return -ENODEV; > +} > + > +static inline int disarm_kprobe_ftrace(struct kprobe *p) > +{ > + return -ENODEV; > +} > #endif > > /* Arm a kprobe with text_mutex */ > -- > 2.11.0 > -- Masami Hiramatsu
Re: [PATCH] kprobes: fix compiler warning
On 07/01/2013 10:33 AM, Dong Fang wrote: Fix the following compiler warning of uninitialized variable kernel/kprobes.c: In function ‘register_kprobe’: kernel/kprobes.c:1493: warning: ‘probed_mod’ may be used uninitialized in this function Signed-off-by: Dong Fang --- kernel/kprobes.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index bddf3b2..7a5b2b1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1490,7 +1490,7 @@ int __kprobes register_kprobe(struct kprobe *p) { int ret; struct kprobe *old_p; - struct module *probed_mod; + struct module *probed_mod = NULL; kprobe_opcode_t *addr; /* Adjust probe address from symbol */ this patch seems have some problem, i will send a new patch later, thx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: fix compiler warning
On 07/01/2013 10:33 AM, Dong Fang wrote: Fix the following compiler warning of uninitialized variable kernel/kprobes.c: In function ‘register_kprobe’: kernel/kprobes.c:1493: warning: ‘probed_mod’ may be used uninitialized in this function Signed-off-by: Dong Fang yp.fangd...@gmail.com --- kernel/kprobes.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index bddf3b2..7a5b2b1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1490,7 +1490,7 @@ int __kprobes register_kprobe(struct kprobe *p) { int ret; struct kprobe *old_p; - struct module *probed_mod; + struct module *probed_mod = NULL; kprobe_opcode_t *addr; /* Adjust probe address from symbol */ this patch seems have some problem, i will send a new patch later, thx -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Jan 30, 2007, at 1:41 AM, Andrew Morton wrote: On Tue, 30 Jan 2007 01:12:17 -0600 Kumar Gala <[EMAIL PROTECTED]> wrote: What are your thoughts on forward Masami patch to Linus for 2.6.20 since it fixes a real bug on PPC? I bumped it up into the for-2.6.20 slot. thanks. - k - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Jan 30, 2007, at 1:41 AM, Andrew Morton wrote: On Tue, 30 Jan 2007 01:12:17 -0600 Kumar Gala [EMAIL PROTECTED] wrote: What are your thoughts on forward Masami patch to Linus for 2.6.20 since it fixes a real bug on PPC? I bumped it up into the for-2.6.20 slot. thanks. - k - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Tue, 30 Jan 2007 01:12:17 -0600 Kumar Gala <[EMAIL PROTECTED]> wrote: > What are your thoughts on forward Masami patch to Linus for 2.6.20 > since it fixes a real bug on PPC? I bumped it up into the for-2.6.20 slot. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Jan 30, 2007, at 1:05 AM, Kumar Gala wrote: On Jan 29, 2007, at 11:55 PM, Ananth N Mavinakayanahalli wrote: On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote: On ppc the compiler gripes about: kernel/kprobes.c: In function 'collect_garbage_slots': kernel/kprobes.c:215: warning: comparison is always false due to limited range of data type The compiler ends up optimizing away the test since char's are unsigned on ppc. Kumar, Masami fixed this last week: http://marc.theaimsgroup.com/?l=linux-kernel=116968723823366=2 Patch currently in -mm. Thanks, Ananth Cool, Masami's patch looks far more complete. Andrew, What are your thoughts on forward Masami patch to Linus for 2.6.20 since it fixes a real bug on PPC? - k - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Jan 29, 2007, at 11:55 PM, Ananth N Mavinakayanahalli wrote: On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote: On ppc the compiler gripes about: kernel/kprobes.c: In function 'collect_garbage_slots': kernel/kprobes.c:215: warning: comparison is always false due to limited range of data type The compiler ends up optimizing away the test since char's are unsigned on ppc. Kumar, Masami fixed this last week: http://marc.theaimsgroup.com/?l=linux-kernel=116968723823366=2 Patch currently in -mm. Thanks, Ananth Cool, Masami's patch looks far more complete. - k - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote: > On ppc the compiler gripes about: > > kernel/kprobes.c: In function 'collect_garbage_slots': > kernel/kprobes.c:215: warning: comparison is always false due to limited > range of data type > > The compiler ends up optimizing away the test since char's are unsigned on > ppc. Kumar, Masami fixed this last week: http://marc.theaimsgroup.com/?l=linux-kernel=116968723823366=2 Patch currently in -mm. Thanks, Ananth > > Signed-off-by: Kumar Gala <[EMAIL PROTECTED]> > > --- > commit 1ee2dc5300b1c454f92eeea82da300f72db1b26f > tree c73cdacb43e154292708d967e11b1cbf7ab4904f > parent c0d4d573feed199b16094c072e7cb07afb01c598 > author Kumar Gala <[EMAIL PROTECTED]> Mon, 29 Jan 2007 23:38:11 > -0600 > committer Kumar Gala <[EMAIL PROTECTED]> Mon, 29 Jan 2007 23:38:11 > -0600 > > kernel/kprobes.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index 17ec4af..514276f 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -212,7 +212,7 @@ static int __kprobes collect_garbage_slots(void) > continue; > kip->ngarbage = 0; /* we will collect all garbages */ > for (i = 0; i < INSNS_PER_PAGE; i++) { > - if (kip->slot_used[i] == -1 && > + if (kip->slot_used[i] == (char)-1 && > collect_one_slot(kip, i)) > break; > } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote: On ppc the compiler gripes about: kernel/kprobes.c: In function 'collect_garbage_slots': kernel/kprobes.c:215: warning: comparison is always false due to limited range of data type The compiler ends up optimizing away the test since char's are unsigned on ppc. Kumar, Masami fixed this last week: http://marc.theaimsgroup.com/?l=linux-kernelm=116968723823366w=2 Patch currently in -mm. Thanks, Ananth Signed-off-by: Kumar Gala [EMAIL PROTECTED] --- commit 1ee2dc5300b1c454f92eeea82da300f72db1b26f tree c73cdacb43e154292708d967e11b1cbf7ab4904f parent c0d4d573feed199b16094c072e7cb07afb01c598 author Kumar Gala [EMAIL PROTECTED] Mon, 29 Jan 2007 23:38:11 -0600 committer Kumar Gala [EMAIL PROTECTED] Mon, 29 Jan 2007 23:38:11 -0600 kernel/kprobes.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 17ec4af..514276f 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -212,7 +212,7 @@ static int __kprobes collect_garbage_slots(void) continue; kip-ngarbage = 0; /* we will collect all garbages */ for (i = 0; i INSNS_PER_PAGE; i++) { - if (kip-slot_used[i] == -1 + if (kip-slot_used[i] == (char)-1 collect_one_slot(kip, i)) break; } - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Jan 29, 2007, at 11:55 PM, Ananth N Mavinakayanahalli wrote: On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote: On ppc the compiler gripes about: kernel/kprobes.c: In function 'collect_garbage_slots': kernel/kprobes.c:215: warning: comparison is always false due to limited range of data type The compiler ends up optimizing away the test since char's are unsigned on ppc. Kumar, Masami fixed this last week: http://marc.theaimsgroup.com/?l=linux-kernelm=116968723823366w=2 Patch currently in -mm. Thanks, Ananth Cool, Masami's patch looks far more complete. - k - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Jan 30, 2007, at 1:05 AM, Kumar Gala wrote: On Jan 29, 2007, at 11:55 PM, Ananth N Mavinakayanahalli wrote: On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote: On ppc the compiler gripes about: kernel/kprobes.c: In function 'collect_garbage_slots': kernel/kprobes.c:215: warning: comparison is always false due to limited range of data type The compiler ends up optimizing away the test since char's are unsigned on ppc. Kumar, Masami fixed this last week: http://marc.theaimsgroup.com/?l=linux-kernelm=116968723823366w=2 Patch currently in -mm. Thanks, Ananth Cool, Masami's patch looks far more complete. Andrew, What are your thoughts on forward Masami patch to Linus for 2.6.20 since it fixes a real bug on PPC? - k - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kprobes: Fix compiler warning
On Tue, 30 Jan 2007 01:12:17 -0600 Kumar Gala [EMAIL PROTECTED] wrote: What are your thoughts on forward Masami patch to Linus for 2.6.20 since it fixes a real bug on PPC? I bumped it up into the for-2.6.20 slot. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/