From: Mikael Pettersson <mikpe@csd.uu.se>
To: AKIYAMA Nobuyuki <akiyama.nobuyuk@jp.fujitsu.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NMI trigger switch support for debugging
Date: Wed, 26 May 2004 11:43:09 +0200 [thread overview]
Message-ID: <16564.26285.431229.665902@alkaid.it.uu.se> (raw)
In-Reply-To: <40B400D1.1080602@jp.fujitsu.com>
AKIYAMA Nobuyuki writes:
> +int unknown_nmi_panic = 0;
It's a kernel coding standard to _not_ explicitly initialise
static-extent data to zero.
> +/*
> + * proc handler for /proc/sys/kernel/unknown_nmi_panic
> + */
> +int proc_unknown_nmi_panic(ctl_table *table, int write,
> + struct file *file, void __user *buffer, size_t *length)
> +{
> + int old_state;
> +
> + old_state = unknown_nmi_panic;
> + proc_dointvec(table, write, file, buffer, length);
> + if (!old_state == !unknown_nmi_panic)
> + return 0;
This conditional looks terribly obscure.
Can you simplify it or explain your intention here?
> + if (unknown_nmi_panic) {
> + if (reserve_lapic_nmi() < 0) {
> + unknown_nmi_panic = 0;
> + return -EBUSY;
> + } else {
> + set_nmi_callback(unknown_nmi_panic_callback);
> + }
> + } else {
> + release_lapic_nmi();
You're invoking release_lapic_nmi() in response to user
input, without having verified that _you_ had done a
reserve_lapic_nmi() before.
It looks like the code will do horrible things if the
operator invokes the sysctl incorrectly. Such errors do
happen, so code should include basic sanity checks.
/Mikael
next prev parent reply other threads:[~2004-05-26 9:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-24 9:21 AKIYAMA Nobuyuki
2004-05-24 9:34 ` Andrew Morton
2004-05-26 1:36 ` AKIYAMA Nobuyuki
2004-05-26 1:41 ` Andrew Morton
2004-05-26 2:28 ` AKIYAMA Nobuyuki
2004-05-26 2:37 ` Andrew Morton
2004-05-26 12:17 ` AKIYAMA Nobuyuki
2004-05-26 12:52 ` Maciej W. Rozycki
2004-05-27 8:43 ` AKIYAMA Nobuyuki
2004-05-26 9:43 ` Mikael Pettersson [this message]
2004-05-26 13:42 ` AKIYAMA Nobuyuki
2004-05-26 20:34 ` Paul Jackson
2004-05-26 21:04 ` Mikael Pettersson
2004-05-24 10:01 ` [PATCH] typo in drivers/usb/class/usblp.c Benoît Dejean
[not found] <1ZjWz-sq-11@gated-at.bofh.it>
[not found] ` <1Zk6a-z2-3@gated-at.bofh.it>
[not found] ` <1ZVyO-63D-25@gated-at.bofh.it>
[not found] ` <1ZVIq-69O-3@gated-at.bofh.it>
[not found] ` <1ZWuM-6Nz-1@gated-at.bofh.it>
[not found] ` <1ZWEt-6Uw-1@gated-at.bofh.it>
2004-05-26 11:23 ` [PATCH] NMI trigger switch support for debugging Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16564.26285.431229.665902@alkaid.it.uu.se \
--to=mikpe@csd.uu.se \
--cc=akiyama.nobuyuk@jp.fujitsu.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®