From: Andrew Morton <akpm@linux-foundation.org>
To: Yoann Padioleau <padator@wanadoo.fr>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@lists.osdl.org
Subject: Re: [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked
Date: Tue, 05 Jun 2007 16:12:58 +0000 [thread overview]
Message-ID: <20070605091258.d38d33de.akpm@linux-foundation.org> (raw)
In-Reply-To: <87k5uimzkh.fsf@wanadoo.fr>
On Tue, 05 Jun 2007 13:05:18 +0200 Yoann Padioleau <padator@wanadoo.fr> wrote:
> Andrew Morton <akpm@linux-foundation.org> writes:
>
> >>
> >> net/wan/lmc/lmc_main.c | 2 +-
> >> scsi/megaraid/megaraid_mm.c | 2 +-
> >> usb/serial/io_ti.c | 2 +-
> >> usb/serial/ti_usb_3410_5052.c | 2 +-
> >> usb/serial/whiteheat.c | 6 +++---
> >> 5 files changed, 7 insertions(+), 7 deletions(-)
> >
> > This patch covers three areas of maintainer responsibility, so poor old me
> > has to split it up and redo the changelogs. Oh well.
>
> Sorry.
>
> For modifications that crosscut the kernel it is not very practical to
> look each time for the maintainer.
That's OK - I can take care of that
> We plan to send a patch that
> replaces some calls to kmalloc/memset with kzalloc; do we have to split
> it for each maintainer ?
Per subsystem: yes, please. That maps pretty well onto per-subdirectory so
I'd suggest that each patch only affect the files in a single directory.
> >> diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
> >> index ae132c1..750b3ef 100644
> >> --- a/drivers/net/wan/lmc/lmc_main.c
> >> +++ b/drivers/net/wan/lmc/lmc_main.c
> >> @@ -483,7 +483,7 @@ #endif /* end ifdef _DBG_EVENTLOG */
> >> break;
> >> }
> >>
> >> - data = kmalloc(xc.len, GFP_KERNEL);
> >> + data = kmalloc(xc.len, GFP_ATOMIC);
> >> if(data = 0x0){
> >> printk(KERN_WARNING "%s: Failed to allocate memory for copy\n", dev->name);
> >> ret = -ENOMEM;
> >
> > A few lines later we do:
> >
> > if(copy_from_user(data, xc.data, xc.len))
> >
> > which also is illegal under spinlock.
>
> I have launched my tool to detect such situations and I get this
> (in a diff-like format).
>
> --- /home/pad/kernels/git/linux-2.6/arch/cris/arch-v10/drivers/gpio.c 2007-03-27 15:12:38.000000000 +0200
> +++ /tmp/output.c 2007-06-05 11:38:47.000000000 +0200
> @@ -776,7 +776,7 @@
> /* bits set in *arg is set to input,
> * *arg updated with current input pins.
> */
> - if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
> {
> ret = -EFAULT;
> break;
> @@ -789,7 +789,7 @@
> /* bits set in *arg is set to output,
> * *arg updated with current output pins.
> */
> - if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
> {
> ret = -EFAULT;
> break;
>
>
> --- /home/pad/kernels/git/linux-2.6/arch/mips/au1000/common/power.c 2007-03-27 15:12:41.000000000 +0200
> +++ /tmp/output.c 2007-06-05 11:38:57.000000000 +0200
> @@ -330,7 +330,7 @@
> spin_unlock_irqrestore(&pm_lock, flags);
> return -EFAULT;
> }
> - if (copy_from_user(buf, buffer, *len)) {
> spin_unlock_irqrestore(&pm_lock, flags);
> return -EFAULT;
> }
>
> and some cases in lmc_main.c
OK.
>
> >
> >
> > Frankly, I think that a better use of this tool would be to just report on
> > the errors, let humans fix them up.
>
> Ok. Do you have a preference on the format ? a <file>:<line> format ?
file-n-line is good. If it can quote the relevant test then that's better
- line numbers change often.
Please always work against the very latest Linus git tree,
> Is there a place that gathered all those implicit programming rules
> (that copy_from_user must not be called inside a spinlock, etc) so that
> I can translate them in a script for our tool.
Not that I can think of, sorry.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Yoann Padioleau <padator@wanadoo.fr>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@lists.osdl.org
Subject: Re: [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region
Date: Tue, 5 Jun 2007 09:12:58 -0700 [thread overview]
Message-ID: <20070605091258.d38d33de.akpm@linux-foundation.org> (raw)
In-Reply-To: <87k5uimzkh.fsf@wanadoo.fr>
On Tue, 05 Jun 2007 13:05:18 +0200 Yoann Padioleau <padator@wanadoo.fr> wrote:
> Andrew Morton <akpm@linux-foundation.org> writes:
>
> >>
> >> net/wan/lmc/lmc_main.c | 2 +-
> >> scsi/megaraid/megaraid_mm.c | 2 +-
> >> usb/serial/io_ti.c | 2 +-
> >> usb/serial/ti_usb_3410_5052.c | 2 +-
> >> usb/serial/whiteheat.c | 6 +++---
> >> 5 files changed, 7 insertions(+), 7 deletions(-)
> >
> > This patch covers three areas of maintainer responsibility, so poor old me
> > has to split it up and redo the changelogs. Oh well.
>
> Sorry.
>
> For modifications that crosscut the kernel it is not very practical to
> look each time for the maintainer.
That's OK - I can take care of that
> We plan to send a patch that
> replaces some calls to kmalloc/memset with kzalloc; do we have to split
> it for each maintainer ?
Per subsystem: yes, please. That maps pretty well onto per-subdirectory so
I'd suggest that each patch only affect the files in a single directory.
> >> diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
> >> index ae132c1..750b3ef 100644
> >> --- a/drivers/net/wan/lmc/lmc_main.c
> >> +++ b/drivers/net/wan/lmc/lmc_main.c
> >> @@ -483,7 +483,7 @@ #endif /* end ifdef _DBG_EVENTLOG */
> >> break;
> >> }
> >>
> >> - data = kmalloc(xc.len, GFP_KERNEL);
> >> + data = kmalloc(xc.len, GFP_ATOMIC);
> >> if(data == 0x0){
> >> printk(KERN_WARNING "%s: Failed to allocate memory for copy\n", dev->name);
> >> ret = -ENOMEM;
> >
> > A few lines later we do:
> >
> > if(copy_from_user(data, xc.data, xc.len))
> >
> > which also is illegal under spinlock.
>
> I have launched my tool to detect such situations and I get this
> (in a diff-like format).
>
> --- /home/pad/kernels/git/linux-2.6/arch/cris/arch-v10/drivers/gpio.c 2007-03-27 15:12:38.000000000 +0200
> +++ /tmp/output.c 2007-06-05 11:38:47.000000000 +0200
> @@ -776,7 +776,7 @@
> /* bits set in *arg is set to input,
> * *arg updated with current input pins.
> */
> - if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
> {
> ret = -EFAULT;
> break;
> @@ -789,7 +789,7 @@
> /* bits set in *arg is set to output,
> * *arg updated with current output pins.
> */
> - if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
> {
> ret = -EFAULT;
> break;
>
>
> --- /home/pad/kernels/git/linux-2.6/arch/mips/au1000/common/power.c 2007-03-27 15:12:41.000000000 +0200
> +++ /tmp/output.c 2007-06-05 11:38:57.000000000 +0200
> @@ -330,7 +330,7 @@
> spin_unlock_irqrestore(&pm_lock, flags);
> return -EFAULT;
> }
> - if (copy_from_user(buf, buffer, *len)) {
> spin_unlock_irqrestore(&pm_lock, flags);
> return -EFAULT;
> }
>
> and some cases in lmc_main.c
OK.
>
> >
> >
> > Frankly, I think that a better use of this tool would be to just report on
> > the errors, let humans fix them up.
>
> Ok. Do you have a preference on the format ? a <file>:<line> format ?
file-n-line is good. If it can quote the relevant test then that's better
- line numbers change often.
Please always work against the very latest Linus git tree,
> Is there a place that gathered all those implicit programming rules
> (that copy_from_user must not be called inside a spinlock, etc) so that
> I can translate them in a script for our tool.
Not that I can think of, sorry.
next prev parent reply other threads:[~2007-06-05 16:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-04 16:25 [KJ] [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region Yoann Padioleau
2007-06-04 16:25 ` Yoann Padioleau
2007-06-05 4:00 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked Andrew Morton
2007-06-05 4:00 ` [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region Andrew Morton
2007-06-05 4:00 ` Andrew Morton
2007-06-05 4:08 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked Andrew Morton
2007-06-05 4:08 ` [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region Andrew Morton
2007-06-05 4:08 ` Andrew Morton
2007-06-05 8:51 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked Oliver Neukum
2007-06-05 8:51 ` [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region Oliver Neukum
2007-06-05 8:51 ` Oliver Neukum
2007-06-05 11:05 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked Yoann Padioleau
2007-06-05 11:05 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region Yoann Padioleau
2007-06-05 11:33 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked Oliver Neukum
2007-06-05 11:33 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region Oliver Neukum
2007-06-05 16:31 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked Yoann Padioleau
2007-06-05 16:31 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region Yoann Padioleau
2007-06-05 16:48 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked Randy Dunlap
2007-06-05 16:48 ` [KJ] Re: [PATCH] bugfix GFP_KERNEL -> GFP_ATOMIC in spin_locked region Randy Dunlap
2007-06-05 16:12 ` Andrew Morton [this message]
2007-06-05 16:12 ` Andrew Morton
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=20070605091258.d38d33de.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=kernel-janitors@lists.osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=padator@wanadoo.fr \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.