public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kzalloc params swapped in pm_qos_power_open
@ 2010-08-22 14:35 Dr. David Alan Gilbert
  2010-08-22 23:34 ` Gross, Mark
  0 siblings, 1 reply; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2010-08-22 14:35 UTC (permalink / raw)
  To: linux-pm; +Cc: James.Bottomley, mark.gross

Hi,
  I was playing with sparse and it looks like it spotted that
the kzalloc in pm_qos_power_open in the current Linus's git tree
seems to have its parameters swapped. I've got a patch below,
I've only build tested it.

Signed-off-by: David Alan Gilbert <linux@treblig.org>
---
**BUILD TESTED ONLY** (against current git)

diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
index 996a4de..71dcc21 100644
--- a/kernel/pm_qos_params.c
+++ b/kernel/pm_qos_params.c
@@ -348,7 +348,7 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp)
 
        pm_qos_class = find_pm_qos_object_by_minor(iminor(inode));
        if (pm_qos_class >= 0) {
-               struct pm_qos_request_list *req = kzalloc(GFP_KERNEL, sizeof(*req));
+               struct pm_qos_request_list *req = kzalloc(sizeof(*req), GFP_KERNEL);
                if (!req)
                        return -ENOMEM;
 

-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\ gro.gilbert @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kzalloc params swapped in pm_qos_power_open
  2010-08-22 14:35 [PATCH] kzalloc params swapped in pm_qos_power_open Dr. David Alan Gilbert
@ 2010-08-22 23:34 ` Gross, Mark
  2010-08-24 20:19   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Gross, Mark @ 2010-08-22 23:34 UTC (permalink / raw)
  To: Dr. David Alan Gilbert, linux-pm@lists.linux-foundation.org
  Cc: James.Bottomley@suse.de

Your right. :(

Its working by luck, GFP_KERNEL (= 0x10|0x40|0x80 = 0xD0 = 208 ) is not too big and not too small.

acked-by: mark gross <markgross@thegnar.org>

--mark



>-----Original Message-----
>From: Dr. David Alan Gilbert [mailto:linux@treblig.org]
>Sent: Sunday, August 22, 2010 7:36 AM
>To: linux-pm@lists.linux-foundation.org
>Cc: James.Bottomley@suse.de; Gross, Mark
>Subject: [PATCH] kzalloc params swapped in pm_qos_power_open
>
>Hi,
>  I was playing with sparse and it looks like it spotted that
>the kzalloc in pm_qos_power_open in the current Linus's git tree
>seems to have its parameters swapped. I've got a patch below,
>I've only build tested it.
>
>Signed-off-by: David Alan Gilbert <linux@treblig.org>
>---
>**BUILD TESTED ONLY** (against current git)
>
>diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
>index 996a4de..71dcc21 100644
>--- a/kernel/pm_qos_params.c
>+++ b/kernel/pm_qos_params.c
>@@ -348,7 +348,7 @@ static int pm_qos_power_open(struct inode *inode,
>struct file *filp)
>
>        pm_qos_class = find_pm_qos_object_by_minor(iminor(inode));
>        if (pm_qos_class >= 0) {
>-               struct pm_qos_request_list *req = kzalloc(GFP_KERNEL,
>sizeof(*req));
>+               struct pm_qos_request_list *req = kzalloc(sizeof(*req),
>GFP_KERNEL);
>                if (!req)
>                        return -ENOMEM;
>
>
>--
> -----Open up your eyes, open up your mind, open up your code -------
>/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
>\ gro.gilbert @ treblig.org |                               | In Hex /
> \ _________________________|_____ http://www.treblig.org   |_______/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kzalloc params swapped in pm_qos_power_open
  2010-08-22 23:34 ` Gross, Mark
@ 2010-08-24 20:19   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2010-08-24 20:19 UTC (permalink / raw)
  To: Gross, Mark
  Cc: linux-pm@lists.linux-foundation.org, James.Bottomley@suse.de,
	Dr. David Alan Gilbert

On Monday, August 23, 2010, Gross, Mark wrote:
> Your right. :(
> 
> Its working by luck, GFP_KERNEL (= 0x10|0x40|0x80 = 0xD0 = 208 ) is not too big and not too small.
> 
> acked-by: mark gross <markgross@thegnar.org>

Applied to suspend-2.6/pm-fixes, I'll ask Linus to pull it after a day or two
in linux-next.

Thanks,
Rafael


> >-----Original Message-----
> >From: Dr. David Alan Gilbert [mailto:linux@treblig.org]
> >Sent: Sunday, August 22, 2010 7:36 AM
> >To: linux-pm@lists.linux-foundation.org
> >Cc: James.Bottomley@suse.de; Gross, Mark
> >Subject: [PATCH] kzalloc params swapped in pm_qos_power_open
> >
> >Hi,
> >  I was playing with sparse and it looks like it spotted that
> >the kzalloc in pm_qos_power_open in the current Linus's git tree
> >seems to have its parameters swapped. I've got a patch below,
> >I've only build tested it.
> >
> >Signed-off-by: David Alan Gilbert <linux@treblig.org>
> >---
> >**BUILD TESTED ONLY** (against current git)
> >
> >diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
> >index 996a4de..71dcc21 100644
> >--- a/kernel/pm_qos_params.c
> >+++ b/kernel/pm_qos_params.c
> >@@ -348,7 +348,7 @@ static int pm_qos_power_open(struct inode *inode,
> >struct file *filp)
> >
> >        pm_qos_class = find_pm_qos_object_by_minor(iminor(inode));
> >        if (pm_qos_class >= 0) {
> >-               struct pm_qos_request_list *req = kzalloc(GFP_KERNEL,
> >sizeof(*req));
> >+               struct pm_qos_request_list *req = kzalloc(sizeof(*req),
> >GFP_KERNEL);
> >                if (!req)
> >                        return -ENOMEM;
> >
> >
> >--
> > -----Open up your eyes, open up your mind, open up your code -------
> >/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
> >\ gro.gilbert @ treblig.org |                               | In Hex /
> > \ _________________________|_____ http://www.treblig.org   |_______/
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-24 20:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-22 14:35 [PATCH] kzalloc params swapped in pm_qos_power_open Dr. David Alan Gilbert
2010-08-22 23:34 ` Gross, Mark
2010-08-24 20:19   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox